creation of a new tab and radpageview

3 posts, 1 answers
  1. Hassan
    Hassan avatar
    4 posts
    Member since:
    Mar 2012

    Posted 08 May 2012 Link to this post

    Hello ,
    I want to create a new tab in my radtabstrip with it's needed radpageview while i run my project.

    This is my code for the program :
     
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadTab tab = new RadTab("New tab");
            RadPageView pageview = new RadPageView();
            pageview.ID = "NewRadPageView";
            pageview.ContentUrl = "Default5.aspx";
            RadMultiPage1.PageViews.Add(pageview);
     
            tab.PageViewID = pageview.ID;
            RadTabStrip1.Tabs.Add(tab);
        }
    }

    "Default5.aspx" is a page of my website that i created it before
    Now i want to load this page in the new radpageview with clicking on the new tab
    It seems my code is true but it doesn't work
    I don't know , Where is it's wrong !!?

    Please tell me what's wrong with my code!
    Reply me as soon as possible :-s

    Thanks alot
    Hassan
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 May 2012 Link to this post

    Hi Hassan,

    I tried the same scenario and it is working fine at my end. Please make sure that you have set MultiPageID property of RadTabStrip. Here is the sample code I tried.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">
        <Tabs>
           <telerik:RadTab Text="RadTab1" ></telerik:RadTab>
           <telerik:RadTab Text="RadTab2"></telerik:RadTab>
           <telerik:RadTab Text="RadTab3"></telerik:RadTab>
           <telerik:RadTab Text="RadTab4"></telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
    </telerik:RadMultiPage>

    C#:
    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadTab tab = new RadTab("New tab");
                RadPageView pageview = new RadPageView();
                pageview.ID = "NewRadPageView";
                pageview.ContentUrl = "Default5.aspx";
                RadMultiPage1.PageViews.Add(pageview);
                tab.PageViewID = pageview.ID;
                RadTabStrip1.Tabs.Add(tab);
            }
        }

    Please provide your full code if it doesn't helps.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hassan
    Hassan avatar
    4 posts
    Member since:
    Mar 2012

    Posted 09 May 2012 Link to this post

    Thank you Princy
    I created a new project and used your code in it
    It worked & Thanks alot , But i don't know why it doesn't work in my project.
    I even set the PageViewID ,  (PageViewID=RadMultiPage1)

    Here is the full code of my project :
    Default.aspx code :
    <head runat="server">
        <title></title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <div>
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" 
                SelectedIndex="0" Skin="Office2007" ontabclick="RadTabStrip1_TabClick" >
                <Tabs>
                    <telerik:RadTab runat="server" PageViewID="RadPageView1" Value="t1" 
                        Text="Root RadTab1" Selected="True">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" PageViewID="RadPageView2" Value="t2" 
                        Text="Root RadTab2">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" ScrollBars="Both" SelectedIndex="0" >
                <telerik:RadPageView ID="RadPageView1" runat="server" 
                    ContentUrl="Default2.aspx" Selected="True">
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView2" runat="server" 
                    ContentUrl="Default3.aspx">
                </telerik:RadPageView>
            </telerik:RadMultiPage>
        </div>
        </form>
    </body>
    </html>

    Default.aspx.cs code :
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Configuration;
    using System.Web.Security;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Telerik.Web.UI;
    using System.Drawing;
      
    public partial class Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadTab tab = new RadTab("New tab");
                RadPageView pageview = new RadPageView();
                pageview.ID = "NewRadPageView";
                pageview.ContentUrl = "Default5.aspx";
                RadMultiPage1.PageViews.Add(pageview);
                tab.PageViewID = pageview.ID;
                RadTabStrip1.Tabs.Add(tab);
            }
        

          protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)        

          {

          }

    }

    Tell me if you realized my code problem!
    Thank you again! :)
    Hassan
Back to Top