PanelBar won't expand when requested through server side code

3 posts, 0 answers
  1. Katie
    Katie avatar
    6 posts
    Member since:
    Jun 2012

    Posted 09 Jul 2012 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 12 Jul 2012 Link to this post

    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.
Back to Top