Extend RadPageView using ascx

4 posts, 1 answers
  1. Baris
    Baris avatar
    34 posts
    Member since:
    Jul 2013

    Posted 17 Jan 2014 Link to this post

    I am using radmultipage. I want to extend radpageview using ascx. So I want to add myRadPageview to radmultipage at runtime. At runtime I can add myRadPageview to radmultipage like that


      

    deneme = new Page1();
    deneme.ID = "123
    RadMultiPage1.PageViews.Add(deneme);
    RadMultiPage1.SelectedIndex = 0;


    After that I add myRadPageview to radmultipage but controls in myRadPageview doesn't exist when I clicked view source in my browser



     

       < div id="RadMultiPage1"><br>           <br>           </div><div id="123"><br>        <br>           </div><input id="RadMultiPage1_ClientState" name="RadMultiPage1_ClientState" type="hidden" /><br>          </div>




    page1.ascx.cs

       

    public partial class Page1 : Telerik.Web.UI.RadPageView{
     public Page1{
    int i = 5
    }
    protected void Page_Load(object sender, EventArgs e; ; }
    {}


    page1.ascx



        <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Page1.ascx.cs" Inherits="Organon.IM.Presentation.ModellingModule.Page1" %><br>    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><br>    <br>    <telerik:RadPageView ID="rpv1" runat="server" Height="159px" Width="163px"><br>    <br>        <
     
    asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br>       
     <asp:Button ID="Button1" runat="server" Text="Button32432"/><br>
     
        <br>    </telerik:RadPageView>


    Why controls which in page1 doesn't show in radmultipage?

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

    Posted 18 Jan 2014 Link to this post

    Hi Baris,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">
        <Tabs>
            <telerik:RadTab Text="Tab1" Selected="true">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
    </telerik:RadMultiPage>

    ASCX:
    <asp:Label ID="label1" runat="server" Text="Tab1">
    </asp:Label>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Submit">
    </telerik:RadButton>

    ASPX C#:
    protected void Page_Init(object sender, EventArgs e)
    {
        RadPageView pageview = new RadPageView();
        pageview.ID = "RadPageView1";
        Control ctrl = Page.LoadControl("PageView.ascx");
        pageview.Controls.Add(ctrl);
        RadMultiPage1.PageViews.Add(pageview);
        RadMultiPage1.SelectedIndex = 0;
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Baris
    Baris avatar
    34 posts
    Member since:
    Jul 2013

    Posted 18 Jan 2014 Link to this post

    what did you write in aspx.cs?

    public
     partial class Page1 : Telerik.Web.UI.RadPageView{

    or

    public partial class Page1 : System.Web.UI.UserControl {

    both of them I get different errors
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Jan 2014 Link to this post

    Hi Baris,

    Please have a look into the C# code snippet which works fine at my end. Please elaborate your requirement if it doesn't help.

    C#:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
     
    public partial class RadTabStrip_AddUserControlPageView : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            RadPageView pageview = new RadPageView();
            pageview.ID = "RadPageView1";
            Control ctrl = Page.LoadControl("PageView.ascx");
            pageview.Controls.Add(ctrl);
            RadMultiPage1.PageViews.Add(pageview);
            RadMultiPage1.SelectedIndex = 0;
        }
    }

    Thanks,
    Princy.
Back to Top