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

Load On Demand RadPageview losing pages

4 Answers 140 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Julie
Top achievements
Rank 1
Julie asked on 02 Apr 2009, 10:01 PM
Hi Telerik Support.

I am using the Tabstrip with pageviews, I am following the example Load on Demand RadPageview...

In my case I am loading child tabs with the associated page view, then dynamically adding controls to the page view.

When the page first loads I can click on all the child tabs and see my content rendered. 
So here is the problem, I can click on child page 1 it renders.. then I click on other child tabs (child page 2) it renders.  When I go back and click on child page 1, my content is gone. 
I know this must be a view state issue...
So any help would be appreciated.
Thanks
Julie

4 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 03 Apr 2009, 07:51 AM
Hi Julie,

Please check if you are setting ID's to the USerControls that you load, i.e.

protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)  
        {  
            string userControlName = e.PageView.ID + "CS.ascx";  
              
            Control userControl = Page.LoadControl(userControlName);  
            userControl.ID = e.PageView.ID + "_userControl";  
              
            e.PageView.Controls.Add(userControl);  
        }  
 

If this is not the case, I think it will be best if you can open a support ticket and send us a simple running project (incl. CSS, images, DB backup and so on) demonstrating the problems. In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Kind regards,
Paul
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Julie
Top achievements
Rank 1
answered on 03 Apr 2009, 04:29 PM
Hi Support Team,
With a twist to this model, I am dynamically creating a table with controls in 

RadMultiPage1_ PageViewCreated
{
    Table tbl new Table();
    tbl.ID = e.PageView.ID + "_table";
    TableRow tblrow new tblRow();
    TableCell tblcell new tblcell();
    tblcell.text = "Some Text";
    tblrow.Controls.Add(tblcell);
    tbl.AddControls(tblrow);
    e.PageView.Controls.Add(tbl);
}

Does the load on demand feature on work with usercontrols?
What is the best approach for this scenario?
~Julie
0
Paul
Telerik team
answered on 06 Apr 2009, 02:07 PM
Hello Julie,

I'm not sure that we clearly understand your question. Could you please provide more details? In addition, please take a look at our Load on Demand RadPageView example that shows the approach.

Kind regards,
Paul
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Julie
Top achievements
Rank 1
answered on 06 Apr 2009, 04:41 PM
Hi Support Team,
I figured out the problem....
With the application I am building I load content as described below.... 
I dynamically add tabs and child tabs, the child tab_click pulls the information below from a data table. 
Then I construct the Table (relying on the rowcount of the datatable) as described below adding a dynamic number of rows. 
It renders fine the first time but as I click on the other parent tabs and child tabs then go back to a tab previously rendered, it does not reload the pageview.  If I add a static counter, it works fine no problem viewing the previously defined pageview. (see example below that does work....

/// This one does not work
RadMultiPage1_ PageViewCreated
{
    DataTable newdata = DataTable
    {
        Sql code to pulls the data....
    }
    if( newdata.Rows.Count > 0 )  \
    {
             Table tbl new Table();
            tbl.ID = e.PageView.ID + "_table";
            for(int i=0; newdata.Rows.Count  > i ; i++)
            {
//This count will never be consistant as the data is dynamic...  in some cases it will datatable will return 5 rows
// In others the datatable will return 30 rows....
               TableRow tblrow new tblRow();
               TableCell tblcell new tblcell();
               tblcell.text = "Some Text";
               tblrow.Controls.Add(tblcell);
               tbl.AddControls(tblrow);
            }
          e.PageView.Controls.Add(tbl);
    }
}


/// This one works
RadMultiPage1_ PageViewCreated
{
    DataTable newdata = DataTable
    {
        Sql code to pulls the data....
    }
    if( newdata.Rows.Count > 0 )  \
    {
             Table tbl new Table();
            tbl.ID = e.PageView.ID + "_table";
            int MaxCnt = 10;
            for(int i=0; MaxCnt > i ; i++)
            {
               TableRow tblrow new tblRow();
               TableCell tblcell new tblcell();
               tblcell.text = "Some Text";
               tblrow.Controls.Add(tblcell);
               tbl.AddControls(tblrow);
            }
          e.PageView.Controls.Add(tbl);
    }
}
If you need a working example, I can provide that in the next few days..... but it is easy to duplicate this issue...
~Julie

Tags
TabStrip
Asked by
Julie
Top achievements
Rank 1
Answers by
Paul
Telerik team
Julie
Top achievements
Rank 1
Share this question
or