Maintain State of pages loaded in Tabs

5 posts, 0 answers
  1. Officialboss
    Officialboss avatar
    43 posts
    Member since:
    Jan 2008

    Posted 26 Jan 2009 Link to this post

    Hello,
    I have been unable to find a solution in the examples and forums.
    On a page I have 3 tabs and 3 invisible Iframes. On Tab click, with autopostback=true,  I make the associated Iframe visible and set the source attribute of the Iframe if it has not previously been loaded. The Iframe loads a ASPC page with its own scriptmanager. If there is a button on the ASPX page loaded into the Iframe which display time on a label, and I click to a different tab and click back, the label is blank. It is seems that page in the Iframe is not maintaining state.

    Does anyone have a solution?

    My goal is to have the user be able to work on a tab, for example enter text in a textbox press a button and have the text displayed a label, click to another tab and click back to previous tab to have the text still display on the label.

    Thanks
    protected void RadTabStrip1_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)  
    {  
     if (!IFrame1Loaded)  
     {  
      path = "TabPages/Page1.aspx?";  
      Iframe1.Attributes.Add("src", path);  
      IFrame1Loaded = true;                      
     }  
     Iframe1.Visible = true;  
    }  

    Tabs
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Visible="true" BorderStyle="Solid" BorderColor="black"  
     BorderWidth="0px" Skin="Outlook" SelectedIndex="0" AutoPostBack="true" OnTabClick="RadTabStrip1_TabClick"
        <Tabs> 
            <telerik:RadTab Text="Page1" ID="tab0" runat="server"></telerik:RadTab> 
            <telerik:RadTab Text="Page2" ID="tab1" runat="server"></telerik:RadTab> 
            <telerik:RadTab Text="Page3" ID="tab2" runat="server"></telerik:RadTab>         
        </Tabs> 
    </telerik:RadTabStrip> 
    <iframe id="Iframe1" src="" runat="server" width="98%" height="98%" frameborder="1" visible="false" ></iframe
    <iframe id="Iframe2" src="" runat="server" width="98%" height="98%" frameborder="1" visible="false" ></iframe
    <iframe id="Iframe3" src="" runat="server" width="98%" height="540px" frameborder="1" visible="false" ></iframe
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 29 Jan 2009 Link to this post

    Hello Officialboss,

    I'm afraid you cannot achieve your goal as on each tab click you have a postback and respectfully the ASPX in the iframe is fully reloaded. I guess you can use the approach from our Load On Demand RadPageView example.

    Best wishes,
    Paul
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Paul Bishop
    Paul Bishop avatar
    23 posts
    Member since:
    Apr 2008

    Posted 29 Jan 2009 Link to this post

    I'm running into the same issue except I'm not using frames.  I've got grids on some of my tabs which get repopulated each time a tab is clicked.  In the server side "TabClicked" event I check to see if the grid data object is null, if so repopulate it.  The grid data object is a custom object I've added to my user controls (which also contains the grid) that stores the data object in viewstate.
  4. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 30 Jan 2009 Link to this post

    Hi Paul,

    Based on this information it is hard to determine why the controls do not preserve their state in the pageviews, which is the default behavior. I suspect there is an issue with the way the control is populated with data.
    If the problem persists, you can open a formal support ticket, and send us the problematic implementation, for additional review.

    Greetings,
    Yavor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Paul Bishop
    Paul Bishop avatar
    23 posts
    Member since:
    Apr 2008

    Posted 30 Jan 2009 Link to this post

    Sorry, this one looks like an "I.D." ten "T" (i.e. ID10T) error.   I was checking a property that is never set in my user control.  I have a nested user control, and the data object is set in the nested control, but not in the container control.  My loading panel still comes up when changing tabs, but I can see that the data is not being re-populated.  Sorry for the confusion.
Back to Top