Change PanelBar selected item in code behind

2 posts, 0 answers
  1. krishnen
    krishnen avatar
    7 posts
    Member since:
    May 2009

    Posted 25 Oct 2010 Link to this post

    Hi All:
    Here is my problem.
    I need to change the selected item in a panel bar at run time.
    I am using the following code to achieve this.. (hapenning on ajax request)
    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
          If hdnMenu.Value = "6" Then
              If (e.Argument.StartsWith("ListesGroupes")) Then
                  If e.Argument.ToString.Split("$")(1) = "1" Then
                     //do something
                     // reset the panel bar
                      Dim myItem As RadPanelItem = DirectCast(RadPanelBar1.FindItemByText("Mes alertes"), RadPanelItem)
                      myItem.Selected = True
                  End If
              End If
      End Sub

    However, the selected is not changing. My page consist of 2 content place holders with a master. I am not using a radajaxmanager in my master/ proxy in child in this case as the application was already built when I took over and am just doing support.

    So this page contains
    1. Content place holder 1
    a. this contains the PanelBar which is named RadPanelBar1
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <telerik:RadPanelBar runat="server" ID="RadPanelBar1"
            Width="100%" Height="100%"  PersistStateInCookie="false"  OnClientItemClicking="OnClientItemClicking" EnableEmbeddedSkins="false" Skin="IroiseSkin">
                <telerik:RadPanelItem Text="Agendas"  Value="AGENDA"  Expanded="true"   PreventCollapse="true">
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Mes RDV" NavigateUrl="" PostBack="false" Value = "AGENDA.RDV"   Selected="true" />
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Mes mémos"  NavigateUrl="" PostBack="false" Value = "AGENDA.MEMO" />
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Mes tâches" NavigateUrl="" PostBack="false" Value = "AGENDA.TACHE"  />
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Mes alertes" NavigateUrl="" PostBack="false" Value = "AGENDA.ALERT" />
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Tout l'agenda" NavigateUrl="" PostBack="false" Value = "AGENDA.TOUT"    />
                            <telerik:RadPanelItem ImageUrl="../Images/flyout_arrow.gif" Text="Agendas groupes" NavigateUrl="" PostBack="false" Value = "AGENDA.GROUPE" />

    2. Content place holder 2
    a. contains the RadAjaxManager + lots of things (radscheduler + radwindows)

    I have been checking till when the changes I make  to the PanelBar, in the above function, remain active and I see that before the RadPanelBar1_PreRender function the changes are still there but after the functions for applything the theme takes over and I lose my changes.

    My idea is that I am doing something wrong in the ajax manager but I am not sure what.
    Please help me in finding the solution to this error.

    Thank you!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Oct 2010 Link to this post

    Hello Krishnen,

    Have you set the AjaxManager- AjaxSettings properly?

    The following link will shed some light on setting AjaxSettings in this case.
    AJAX Manager
    RadAjax and MasterPage

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top