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

Load on Demand - Loading same control

5 Answers 121 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Temp
Top achievements
Rank 1
Temp asked on 19 Jun 2008, 02:37 AM
Hi I am using the LoadOnDemand example verbatim, but what I want to do is instead of loading three different web controls called customers, products, orders, I want to load the same web control in each pageview.

I have changed only a line in the code behind page. I am using a web control called timetest.ascx, which just displays the time on the page when loaded.

They all load fine and display a different time, but the problem is that I cannot get the RadTabStrip to change back to a pageView after it is loaded. i.e If you click tab 1 then 2 then 3 you see all the tabs loaded ok, but then clicking back to tab 2 or 3, the pageView stays on 3.

This doesn't happen if I load the three differently named usercontrols as is in the example. Can you please help me work this out?

5 Answers, 1 is accepted

Sort by
0
Temp
Top achievements
Rank 1
answered on 19 Jun 2008, 02:38 AM
using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.HtmlControls;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Xml.Linq;  
 
using Mariner7.TalentManager;  
using Telerik.Web.UI;  
 
 
public partial class KeywordReplacements : System.Web.UI.Page  
{  
 
    protected void Page_Load(object sender, System.EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            AddTab("Customers");  
            AddPageView(RadTabStrip1.FindTabByText("Customers"));  
            AddTab("Products");  
            AddTab("Orders");  
        }  
    }  
 
    private void AddTab(string tabName)  
    {  
        RadTab tab = new RadTab();  
        tab.Text = tabName;  
        RadTabStrip1.Tabs.Add(tab);  
    }  
 
    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)  
    {  
        string userControlName = "/Resources/UserControls/TimeTest.ascx";   
 
        Control userControl = Page.LoadControl(userControlName);  
        userControl.ID = e.PageView.ID + "_userControl";  
 
        e.PageView.Controls.Add(userControl);  
    }  
 
    private void AddPageView(RadTab tab)  
    {  
        RadPageView pageView = new RadPageView();  
        pageView.ID = tab.Text;  
        RadMultiPage1.PageViews.Add(pageView);  
        pageView.CssClass = "pageView";  
        tab.PageViewID = pageView.ID;  
    }  
 
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)  
    {  
        AddPageView(e.Tab);  
        e.Tab.PageView.Selected = true;  
    }  
}  
 
0
Temp
Top achievements
Rank 1
answered on 19 Jun 2008, 10:23 PM
Come on guys I'm sure this is a really simple thing to do and will only take a line or two :(
0
Temp
Top achievements
Rank 1
answered on 19 Jun 2008, 11:25 PM
Never mind guys, it's to do with all pageviews reloading everytime a tab is clicked. How do I prevent this?
0
Larkin Young
Top achievements
Rank 2
answered on 20 Jun 2008, 04:35 PM
Have you tried setting the property RenderSelectedPageViewOnly to true? This will cause only the selected page view to render, as the property name implies. I believe this will resolve your issue, if I understand the problem correctly.

- Larkin
0
Doug Odegaard
Top achievements
Rank 2
answered on 27 Jun 2008, 08:07 PM
So by using RenderSelectedPageViewOnly I'm assuming that you must persist changes to the database every time before you load the next tab...correct?
Tags
TabStrip
Asked by
Temp
Top achievements
Rank 1
Answers by
Temp
Top achievements
Rank 1
Larkin Young
Top achievements
Rank 2
Doug Odegaard
Top achievements
Rank 2
Share this question
or