RadPanelBar, ViewState off and PostBack problem

5 posts, 0 answers
  1. Chen
    Chen avatar
    46 posts
    Member since:
    Oct 2010

    Posted 22 Apr 2011 Link to this post

    My app has ViewState disabled.
    I have a panel bar with multiple items. Depending on some server side logic, I may hide some panel items.
    The PanelBar loads fine.
    However, on postback the wrong panel item opens.
    Let's say I have 5 panel items and the server side logic hides the first one.
    If I click Edit on the 4th item, on postback the 3rd item would open.

    In the example below, no panel would be open on postback.
    How can I fix it?


    <telerik:RadPanelBar ID="RadPanelBar1" Runat="server">
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem1">
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2" Selected="True">
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem3">
                            <asp:FormView ID="FormView1" runat="server" DataSourceID="LinqDataSourcePayee"
                                    <asp:TextBox ID="firstNameTextBox" runat="server"
                                        Text='<%# Bind("firstName") %>' />
                                    <br />
                                    <asp:TextBox ID="lastNameTextBox" runat="server"
                                        Text='<%# Bind("lastName") %>' />
                                    <br />
                                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
                                        CommandName="Update" Text="Update" />
                                     <asp:LinkButton ID="UpdateCancelButton" runat="server"
                                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                    <asp:Label ID="firstNameLabel" runat="server" Text='<%# Bind("firstName") %>' />
                                    <br />
                                    <asp:Label ID="lastNameLabel" runat="server" Text='<%# Bind("lastName") %>' />
                                    <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
                                        CommandName="Edit" Text="Edit" />

    Code behind:
    protected void Page_Load(object sender, EventArgs e)
           RadPanelBar1.Items[0].Visible = RadPanelBar1.Items[0].Enabled =false;

  2. Chen
    Chen avatar
    46 posts
    Member since:
    Oct 2010

    Posted 28 Apr 2011 Link to this post

  3. Dimitar Terziev
    Dimitar Terziev avatar
    1268 posts

    Posted 29 Apr 2011 Link to this post

    Hi Chen,

    We have already responded to your support ticket regarding this issue.

    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  4. Spencer
    Spencer avatar
    4 posts
    Member since:
    Aug 2011

    Posted 09 Feb 2012 Link to this post

    Really Telerik? 

    Saying, "we already responded" and not providing a link to your reply doesn't help others who find this page with a similar problem.

    Come on guys, you're better than this.
  5. Kate
    Kate avatar
    1898 posts

    Posted 14 Feb 2012 Link to this post

    Hi Spencer,

    Since the response was in a support ticket there is no way that we can provide its url. However, below you can find the answer of the ticket along with a runnable page:

    In general when the ViewState is disabled, it's your responsibility to restore the state of the page after a post-back. You can find the attached example page where the expanded items are saved into a hidden field on the page and when a post-back occur in Page_Load event these items are expanded again manually. This should prevent problems with the wrong expanded items even, if you hide/remove some of them.

    Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top