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

Maintain State of pages loaded in Tabs

4 Answers 124 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Officialboss
Top achievements
Rank 1
Officialboss asked on 26 Jan 2009, 07:17 PM
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

4 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 29 Jan 2009, 02:29 PM
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.
0
Paul Bishop
Top achievements
Rank 1
answered on 29 Jan 2009, 09:50 PM
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.
0
Yavor
Telerik team
answered on 30 Jan 2009, 02:40 PM
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.
0
Paul Bishop
Top achievements
Rank 1
answered on 31 Jan 2009, 04:50 AM
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.
Tags
TabStrip
Asked by
Officialboss
Top achievements
Rank 1
Answers by
Paul
Telerik team
Paul Bishop
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or