+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Menu panel bar problem

Menu panel bar problem

9 posts, 0 answered
  1. karnan sekar
    karnan sekar avatar
    80 posts
    Registered:
    07 Jul 2009
    14 Aug 2009
    Link to this post
    Hi Georgi,

    We are using sitefinity 3.2,  we are have created pages in the below order

    Home
    About Us
    Media center
       ---- Press Release
       ----Video Library
       ----- Photo Gallery


    Media center page is set as a Page group.
    We have created a user control for displaying a press releases with a gridview paging with page numbers, next and previous button. If we click  next or previous or page number the sub menu get disappear. Only the Main menu appears.

    Please give us a suggestion ASAP, since site is going for client review.

    Thanks,
    Karnan





  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Aug 2009
    Link to this post
    Hi karnan sekar,

    Generally when you click on any page number you cause a post back and the PanelBar probably collapse. The GroupPage redirects to its first page buy default, so when you click on "Media Center" you should go to "Press Release" page. If the GridView control is there you should stay to this page after postbacks between page switching and Level one items should remain expanded. I tried to reproduce the issue you have with simple implementation of GridView control bounded to a datasource with no success. Could you send use some code you use?

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. karnan sekar
    karnan sekar avatar
    80 posts
    Registered:
    07 Jul 2009
    18 Aug 2009
    Link to this post
    Hi Ivan Dimitrov,


    //Below is the code

    //// the .ascx
    <asp:GridView ID="grdPressRelease" runat="server" PageSize="3" GridLines="None" Width="100%"
            AutoGenerateColumns="false" AllowPaging="true" OnDataBound="grdPressRelease_DataBound"
            OnPageIndexChanging="grdPressRelease_PageIndexChanging"  >
           
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <div class="PressList">
                            <div class="NewsListing">
                                <h3>
                                    <%#DataBinder.Eval(Container.DataItem, "Date")%>
                                </h3>
                                <h4>
                                    <%#DataBinder.Eval(Container.DataItem, "Title")%>
                                </h4>
                                <p>
                                    <%#DataBinder.Eval(Container.DataItem, "Summary")%>
                                    <br class="clear" />
                                    <a href='<%#DataBinder.Eval(Container.DataItem, "MoreUrl")%>'>More</a></p>
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
          
          
          <PagerSettings  Position="Top"/>
               <PagerTemplate>
                <div class="TopDesc2">
                    <div class="left page">
                        Page  <%=grdPressRelease.PageIndex + 1%> of  <%=grdPressRelease.PageCount%></div>
                    <div class="right">
               
                            
                                <asp:LinkButton ID="lbPrev" runat="server" CommandArgument="Prev" CssClass="prev" CommandName="Page" CausesValidation="false" ><img height="7" width="8" alt="Previous" src="/Images/hm_more2.gif" /></asp:LinkButton>
                        
                                <asp:LinkButton ID="linklbl1" runat="server" CommandArgument="Next" CommandName="Page" CausesValidation="false"></asp:LinkButton>
                         
                                <asp:LinkButton ID="linklbl2" runat="server" CommandArgument="Next" CommandName="Page" CausesValidation="false"></asp:LinkButton>
                       
                                <asp:LinkButton ID="linklbl3" runat="server" CommandArgument="Next" CommandName="Page" CausesValidation="false"></asp:LinkButton>
                
                                <asp:LinkButton ID="linklbl4" runat="server" CommandArgument="Next" CommandName="Page" CausesValidation="false"></asp:LinkButton>

                            
                                <asp:LinkButton ID="lbNext" runat="server" CommandArgument="Next" CssClass="next" CommandName="Page" CausesValidation="false"> <img height="7" width="8" alt="Next" src="/Images/hm_more1.gif" /> </asp:LinkButton>
                        </ul>
                    </div>
                </div>
            </PagerTemplate>
        </asp:GridView>

    ////.ascx.cs file

    #region " Current Selected Page of the GridView"
        /// <summary>
        /// Stores Current Selected Page of the GridView
        /// </summary>
        public int CurrentSelectedPage
        {
            get
            {
                return intCurrentSelectedPage;
            }
            set
            {
                intCurrentSelectedPage = value;
            }
        }
        #endregion

     #region " Global variables "


        private int intCurrentSelectedPage;
        string strViewNews = ConfigurationSettings.AppSettings["PressDetails"].ToString();
        string strCategoryNews = ConfigurationSettings.AppSettings["CategoryPressRelease"].ToString();


        #endregion


     protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    BindGrid();
                }
                catch (Exception ex)
                {
                    AppLogger.LogError(ex.Message, AppLogger.Severity.Failure);
                }
         
            }
        }


    #region " Grid Bind "

        private void BindGrid()
        {

            try
            {



                DataTable dtNewsHome = new DataTable();
                dtNewsHome.Columns.Add("ID");
                dtNewsHome.Columns.Add("Title");
                dtNewsHome.Columns.Add("Summary");
                dtNewsHome.Columns.Add("Date");
                dtNewsHome.Columns.Add("ThumbUrl");
                dtNewsHome.Columns.Add("MoreUrl");


                NewsManager newsManager = new NewsManager("News");


                IMetaSearchInfo[] filters = new IMetaSearchInfo[3];
                filters[0] = new MetaSearchInfo(MetaValueTypes.DateTime, "Expiration_Date", DateTime.Now, SearchCondition.GreaterOrEqual);
                filters[1] = new MetaSearchInfo(MetaValueTypes.ShortText, "Category", strCategoryNews);
                filters[2] = new MetaSearchInfo(MetaValueTypes.DateTime, "Publication_Date", DateTime.Now, SearchCondition.LessOrEqual);

                //Filter Category
                IList newsList = newsManager.Content.GetContent(0, int.MaxValue, "Publication_Date DESC", filters);

                if (newsList.Count > 0)
                {
                    foreach (IContent ICntNews in newsList)
                    {
                        DateTime PulicationDate = Convert.ToDateTime(ICntNews.GetMetaData("Publication_Date"));


                        if (PulicationDate.ToString("yyyy") == hdnYear.Value)
                        {
                            string strMoreUrl = "" + strViewNews + "?pid=" + ICntNews.ID + "";
                            string strTitle = ICntNews.GetMetaData("Title").ToString();
                            string strThumbnail = ICntNews.GetMetaData("Thumbnail").ToString().Replace(".sflb", ".tmb?width=87&height=79&proportional=false&decreaseOnly=true");
                            string strSummary = ICntNews.GetMetaData("Summary").ToString();
                            string strPublication = PulicationDate.ToString("dd/MM/yyyy");

                            dtNewsHome.Rows.Add(ICntNews.ID, strTitle, strSummary, strPublication, strThumbnail, strMoreUrl);
                        }

                    }

                

                    grdPressRelease.DataSource = dtNewsHome;
                    grdPressRelease.DataBind();
                    grdPressRelease.Dispose();
                    dtNewsHome.Dispose();

                }
                else
                {
                    grdPressRelease.DataSource = dtNewsHome;
                    grdPressRelease.DataBind();
                    grdPressRelease.Dispose();
                    dtNewsHome.Dispose();
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex.Message, AppLogger.Severity.Failure);
            }
        }
        #endregion

    #region " Paging  "
        protected void grdPressRelease_DataBound(object sender, EventArgs e)
        {
            if (grdPressRelease.Rows.Count > 0)
            {
                GridViewRow gNavFooter = grdPressRelease.TopPagerRow;
                LinkButton lbP = gNavFooter.FindControl("lbPrev") as LinkButton;
                LinkButton lbN = gNavFooter.FindControl("lbNext") as LinkButton;
                try
                {
                    if (grdPressRelease.PageIndex == 0)
                    {
                        lbP.Enabled = false;

                    }

                    int iStartIndex = 0;
                    int iCurrentPage = CurrentSelectedPage + 1;

                    int iCalc = (iCurrentPage / 4) + ((iCurrentPage % 4) >= 1 ? 1 : (iCurrentPage % 4));

                    if (iCalc > 1)
                    {
                        iStartIndex = (((iCalc * 4) - 4) + 1);
                    }
                    else
                    {
                        iStartIndex = 1;
                    }

                    for (int i = 1; i <= 4; i++)
                    {
                        LinkButton lb = gNavFooter.FindControl("linklbl" + i.ToString()) as LinkButton;

                        

                        lb.Text = iStartIndex.ToString();                   


                        if (iCurrentPage.ToString() == lb.Text)
                        {
                            lb.Attributes.Add("class","selected");
                        }

                        lb.CommandArgument = iStartIndex.ToString();
                        if (iStartIndex > grdPressRelease.PageCount)
                        {
                            lb.Visible = false;

                        }
                        if (iStartIndex == grdPressRelease.PageIndex + 1)
                        {
                            //lb.Enabled = false;

                        }

                     

                        iStartIndex++;
                    }

                    if (grdPressRelease.PageIndex == grdPressRelease.PageCount - 1)
                    {
                        lbN.Enabled = false;
                    }
                }
                catch (Exception ex)
                {
                    AppLogger.LogError(ex.Message, AppLogger.Severity.Failure);
                }
            }


        }
        protected void grdPressRelease_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            CurrentSelectedPage = e.NewPageIndex;
            grdPressRelease.PageIndex = e.NewPageIndex;
            BindGrid();
        }
        #endregion






  4. Rambhopal Reddy
    Rambhopal Reddy avatar
    2 posts
    Registered:
    31 Jul 2009
    18 Aug 2009
    Link to this post
    Same Problem i want my custom menu below like


    Home  Media         About Us Contact Us                        
               TV
                CInema
                Chaneels
                News paper

    The above Menu Media have child menu for Media root item.

    Could you Please help on this code ASAP. I appreciate your help

    Thank you
    Rambhopal Reddy
  5. karnan sekar
    karnan sekar avatar
    80 posts
    Registered:
    07 Jul 2009
    18 Aug 2009
    Link to this post
    Hi Ram,

    I am not using custom menu, any way you can use the below code.

     CmsManager manager = new CmsManager();
    IList listOfPages = manager.GetPages();

     if (listOfPages.Count > 0)
            {

                foreach (ICmsPage IcPageLinks in listOfPages)
                {
                    if (IcPageLinks.Navigable == true )
                    {
                     // add rows  to datatable and  bind it
                    }
                }
            }
  6. Rambhopal Reddy
    Rambhopal Reddy avatar
    2 posts
    Registered:
    31 Jul 2009
    19 Aug 2009
    Link to this post
    Hi karnan sekar


    I want to know about predefined methods,

    i want custom menu..which i mentioned earlier.

    for that your solution helps me but still i have questions in that.

    Getpages method i can collect all page Name but i have created  Menu item for one page like Media this page is set property as  Page Group.

    in that i have few more pages..  like    press, tv.

    now i want to collect in that page group which is like child nodes


     public IPage GetChildPageByName(Guid parentId, string pageName);

    for that i believe this method will help but i want to know how i pass parentid and pageName

    Please let me know few samples if you know..

    Regards
    Rambhopal
     

  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Aug 2009
    Link to this post
    Hello Rambhopal Reddy,

    Here is a quick example of getting the Child Pages by parent page id:
    // create a new instance of CmsManager 
    Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager(); 
    // get the current node of sitemap 
    Telerik.Cms.Web.CmsSiteMapNode currentNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.CurrentNode; 
    // get the CmsPage represented by the current node and extract its ID 
    Telerik.Cms.ICmsPage currentPage = currentNode.CmsPage; 
    Guid currentPageId = currentPage.ID; 
    // get all child pages of currentPage 
    IList childPages = cmsManager.GetPages(currentPageId); 
    // write out the number of child pages 
    Response.Write(childPages.Count.ToString()); 

    For more information on getting pages, please take a look at the following article : Finding Pages

    I hope this helps.

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  8. karnan sekar
    karnan sekar avatar
    80 posts
    Registered:
    07 Jul 2009
    04 Sep 2009
    Link to this post
    Hi Ivan Dimitrov,

    Did you find solution for the code which i pasted in the thread?

    Thanks,
    :) Karnan


  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Sep 2009
    Link to this post
    Hello karnan sekar,

    I tried to reproduce the problem using your code and RadPanelBar control. The problem was not reproduced. Could you tell us which navigation control you use to show your pages? Could you provide us more details or screenshots with description that represents this issue?

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
9 posts, 0 answered