Dynamic TabStrip/MultiPage/PageView

3 posts, 0 answers
  1. TommyBoy
    TommyBoy avatar
    22 posts
    Member since:
    Oct 2011

    Posted 07 Apr 2014 Link to this post

    Hello Community!

    I am trying to find a solution to dynamically create TabStrip with MultiPage and Pageviews with UserControls from a SQL database.

    Here is what I have thus far.
    SQL Table: ID, ParentID, TabName, URL, Position, NavBar, Page, and Active columns.
    I store the path to the webpage and UserControls in the URL column.
    The rest of the columns are for sorting and visibility per user/page/etc.

    Here is my HeaderControl.ascx code.
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" CausesValidation="False" Skin="Black" Width="100%"></telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0"></telerik:RadMultiPage>

    Here is my codeBehind.
    public int _Page;
    protected void Page_Load(object sender, EventArgs e)
        int _FID = Convert.ToInt32(Session["_FID"]);
        int _AID = Convert.ToInt32(Session["_AID"]);
        IMasterPage masterPage = Page.Master as IMasterPage;
        if (masterPage.bodyID == "DB")
            _Page = 1;
            Page.Title = string.Format("Virtual Law Desk :: Dashboard");
        else if (masterPage.bodyID == "CM")
            _Page = 2;
            Page.Title = string.Format("Virtual Law Desk :: Client Management");
        StandardClass SC = new StandardClass();
            if (!SC.IsError)
                SC.ReturnLawfirmUser(_FID, _AID);
                    fnLbl.Text = SC.FirstName;
                    lnLbl.Text = SC.LastName;
        NavigationClass NC = new NavigationClass();
            if (!NC.IsError)
                RadMenu1.DataSource = NC.ReturnTabNavigation();
                RadMenu1.DataTextField = "tabname";
                RadMenu1.DataNavigateUrlField = "url";
                RadMenu1.DataValueField = "pid";
                RadMenu1.DataFieldID = "id";
                RadTabStrip1.DataSource = NC.ReturnSubTabNavigation(_Page);
                RadTabStrip1.DataTextField = "tabname";
                //RadTabStrip1.DataNavigateUrlField = "url";
                RadTabStrip1.DataValueField = "pid";
                RadTabStrip1.DataFieldID = "id";
                RadTabStrip1.SelectedIndex = -1;
                RadPageView pageView = new RadPageView();
                pageView.ID = "pid";
                RadMultiPage MultiPage1 = RadMultiPage1;
                    Control userControl = Page.LoadControl(NC.URL);

    All classes are derived from a class.dll file I have created. Everything work perfectly except the UserControls for each of the PageViews. Each Main Navigation when clicked on will produce Sub Navigation Tabs which works fine. The PageViews are created as well but each of those PageViews will have a different UserControl. These UserControls paths are read from the URL column in SQL. BAsed on the NC.ReturnUserControls Class how can I make this work? Am I missing an iteration or something like it?

    Thanks for any replies!

  2. Plamen
    Plamen avatar
    2723 posts

    Posted 10 Apr 2014 Link to this post


    The provided code is not enough to find our what exactly is not working correctly in your case. That is why I will recommend you to refer to this on-line demo where is explained exactly how we recommend adding dynamically tabs and multipages and compare your scenario accordingly.

    Hope this will be helpful.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. TommyBoy
    TommyBoy avatar
    22 posts
    Member since:
    Oct 2011

    Posted 10 Apr 2014 in reply to Plamen Link to this post

    I have been so busy I forgot I posted here. I actually came up with the solution. If anyone needs a snippet of code for this let me know.
Back to Top