Avoid reloading of dynamic pageview on postback

2 posts, 0 answers
  1. Akhil
    Akhil avatar
    1 posts
    Member since:
    Jul 2015

    Posted 29 Oct 2015 Link to this post

    Hi I have a RadTabStrip which has several RadPageView. And I am creating dynamic tabs and pageview for the tabs. Each Pageview has a user control.Within the user control i am rendering a form which is also created dynamically.  My problem is that when an event occurs such as button click (edit/save) on one user control, it again loads all the User controls, since the tabs and pageviews are created dynamically i have to recreate all tabs and pageview again. So, all the user controls loads again.

    I just want only one user control to do post back, such as save, while keeping other tabs and pageview intact without reloading it.

    Is that possible?​.



  2. Ivan Danchev
    Ivan Danchev avatar
    2184 posts

    Posted 03 Nov 2015 Link to this post


    When you add RadTabs and RadPageView's dynamically to the RadTabStrip and the RadMultiPage respectively, they do not need to be recreated on every postback. So you can put the logic responsible for adding them in a if (!IsPostBack) statement, for example:
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            RadTab tab = new RadTab("NewTab");
            RadPageView pageView = new RadPageView();
            pageView.ID = tab.Text + "_pageView";
            tab.PageViewID = pageView.ID;
            RadTabStrip1.Tabs.FindTabByText("NewTab").Selected = true;
            RadMultiPage1.PageViews[3].Selected = true;
        Control userControl = Page.LoadControl("WebUserControl2.ascx");
        userControl.ID = RadMultiPage1.PageViews[3].ID + "_userControl";

    However, the code for adding the user control is outside the if statement, because unlike Tabs and PageViews when you add user controls dynamically they must be recreated on every postback.

    Ivan Danchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top