This is a migrated thread and some comments may be shown as answers.

Change PanelBar selected item in code behind

1 Answer 136 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
krishnen
Top achievements
Rank 1
krishnen asked on 25 Oct 2010, 09:33 AM
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
              Else
                 // reset the panel bar
                  RadPanelBar1.ClearSelectedItems()
                  Dim myItem As RadPanelItem = DirectCast(RadPanelBar1.FindItemByText("Mes alertes"), RadPanelItem)
                  myItem.Selected = True
                  myItem.ExpandParentItems()
              End If
          End If
      Else
  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">
        <Items>
            <telerik:RadPanelItem Text="Agendas"  Value="AGENDA"  Expanded="true"   PreventCollapse="true">
                <Items>
                        <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" />
                </Items>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelBar>
</asp:Content>



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!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Oct 2010, 10:41 AM
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


-Shinu.
Tags
PanelBar
Asked by
krishnen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or