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

PanelBar won't expand when requested through server side code

2 Answers 45 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Katie
Top achievements
Rank 1
Katie asked on 09 Jul 2012, 01:26 PM
I have an image map on my page, and when the image map is clicked I woud like to set which item in the panel is displayed. So I have set it up like this:

protected void ImageMap1_Click(object sender, ImageMapEventArgs e)
   {
       foreach (RadPanelItem item in rdPanelMapKey.Items)
       {
           item.Expanded = false;
       }
       rdPanelMapKey.Items[0].Expanded = true;
   }

<telerik:RadPanelBar runat="server" Skin="Vista" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false"
        ID="rdPanelMapKey" Width="220" ExpandMode="SingleExpandedItem" PersistStateInCookie="false" ViewStateMode="Disabled">
        <Items>
            <telerik:RadPanelItem Text="DETAILS" Expanded="false">
                <ContentTemplate>
                    <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" EnableAJAX="true" LoadingPanelID="RadAjaxLoadingPanel2">
                        <uc:AccommodationTooltip runat="server" ID="ucAccommodationTooltip" />    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type='text/javascript'>
            $('.map').maphilight({ "stroke": false });
        </script>
    </telerik:RadScriptBlock>
                    </telerik:RadAjaxPanel>
                     
 
                </ContentTemplate>
            </telerik:RadPanelItem>
            <telerik:RadPanelItem Text="IMAGE" Expanded="true">
                <ContentTemplate>
                    <img src="images/key.gif" />
                </ContentTemplate>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelBar>

But it doesn't work.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Jul 2012, 12:30 PM
Hello Katie,

I suppose what you want is on an image click you want to expand a RadPanelBarItem.
Try the following code snippet and markup
aspx:
<telerik:RadPanelBar runat="server" Skin="Vista" ID="rdPanelMapKey" Width="220" ExpandMode="SingleExpandedItem"
    PersistStateInCookie="false" ViewStateMode="Disabled">
    <Items>
        <telerik:RadPanelItem Text="DETAILS">
            <ContentTemplate>
                <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" EnableAJAX="true"       LoadingPanelID="RadAjaxLoadingPanel2">
                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                        <script type='text/javascript'>
                            $('.map').maphilight({ "stroke": false });
                        </script>
                    </telerik:RadScriptBlock>
                </telerik:RadAjaxPanel>
                <asp:TextBox ID="txtbox1" runat="server" TextMode="MultiLine">
                </asp:TextBox>
            </ContentTemplate>
        </telerik:RadPanelItem>
        <telerik:RadPanelItem Text="IMAGE">
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>
<br />
<br />
<asp:ImageButton ID="Edit" runat="server" ImageUrl="Images/edit.jpg" OnClick="Edit_Click" />
C#:
protected void Edit_Click(object sender, ImageClickEventArgs e)
   {
       foreach (RadPanelItem item in rdPanelMapKey.Items)
       {
           item.Expanded = false;
       }
       rdPanelMapKey.Items[0].Expanded = true;
   }

Thanks,
Shinu.
0
Kate
Telerik team
answered on 12 Jul 2012, 12:40 PM
Hello Katie,

I tested the scenario that you describe but I am not able to get the issue that you encounter. I attached my testing project to this post. Please give it a try and let me know if this works from your side. I would also recommend that you open a support ticket where you can attach a simplified runnable project that demonstrates the issue so I can help you out in your specific case.

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
PanelBar
Asked by
Katie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kate
Telerik team
Share this question
or