使用ascx扩展RadPageView

时间:2014-01-17 15:27:25

标签: telerik ascx rad-controls

我正在使用radmultipage。我想使用ascx扩展radpageview。所以我想在运行时将myRadPageview添加到radmultipage。在运行时,我可以将myRadPageview添加到radmultipage,就像那样

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

之后我将myRadPageview添加到radmultipage,但是当我在浏览器中单击视图源时,myRadPageview中的控件不存在

< div id="RadMultiPage1">

                </div><div id="123">

                </div><input id="RadMultiPage1_ClientState" name="RadMultiPage1_ClientState" type="hidden" />
            </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" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<telerik:RadPageView ID="rpv1" runat="server" Height="159px" Width="163px">

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button1" runat="server" Text="Button32432"/>

</telerik:RadPageView>

为什么控制page1中哪些不显示在radmultipage中?

1 个答案:

答案 0 :(得分:0)

我找到解决方案。在运行时,我可以将myRadPageview添加到radmultipage,就像那样

Telerik.Web.UI.RadPageView dataSelectionPV = new Telerik.Web.UI.RadPageView();
dataSelectionPV.ID = "dataSelectionPV";
System.Web.UI.Control ctrl = Page.LoadControl("DevelopmentSample.ascx");
dataSelectionPV.Controls.Add(ctrl);

developmentSample.ascx

public partial class DevelopmentSample : System.Web.UI.UserControl
...

我也从.ascx.cs

中删除了<telerik:RadPageView ID="rpv1" runat="server" Height="159px" Width="163px">个标签

我的新.ascx.cs文件

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Page1.ascx.cs" Inherits="Organon.IM.Presentation.ModellingModule.Page1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button1" runat="server" Text="Button32432"/>