Load on Demand - Loading same control

6 posts, 0 answers
  1. Temp
    Temp avatar
    55 posts
    Member since:
    May 2007

    Posted 18 Jun 2008 Link to this post

    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?

  2. Temp
    Temp avatar
    55 posts
    Member since:
    May 2007

    Posted 18 Jun 2008 Link to this post

    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;  
        }  
    }  
     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Temp
    Temp avatar
    55 posts
    Member since:
    May 2007

    Posted 19 Jun 2008 Link to this post

    Come on guys I'm sure this is a really simple thing to do and will only take a line or two :(
  5. Temp
    Temp avatar
    55 posts
    Member since:
    May 2007

    Posted 19 Jun 2008 Link to this post

    Never mind guys, it's to do with all pageviews reloading everytime a tab is clicked. How do I prevent this?
  6. Larkin Young
    Larkin Young avatar
    141 posts
    Member since:
    Feb 2005

    Posted 20 Jun 2008 Link to this post

    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
  7. Doug Odegaard
    Doug Odegaard avatar
    51 posts
    Member since:
    Oct 2004

    Posted 27 Jun 2008 Link to this post

    So by using RenderSelectedPageViewOnly I'm assuming that you must persist changes to the database every time before you load the next tab...correct?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017