Question

I'am using radMultipage. If I add the radpageviews at aspx like that

    <telerik:RadMultiPage ID="RadMultiPage1" Runat="server" OnPageViewCreated="RadMultiPage1_PageViewCreated">
                <telerik:RadPageView ID="RadPageView1" runat="server" Height="159px" Width="163px">
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
                </telerik:RadPageView>

                <telerik:RadPageView

 ID="RadPageView2" runat="server" Height="159px" Width="163px">
                <asp:Label ID="Label2" runat="server" Text="Label">
                </asp:Label>
                <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
            </telerik:RadPageView>
        </telerik:RadMultiPage>

at code behind I can use that

Label2.Text = "asdasdasas";

but it if I add the radpageviews at runtime like that

        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);

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

I cant reach label2 at runtime at code behind. So ı cant write

Label2.Text = "asdasdasas";

at runtime how can I reach items in pageview which adds to multipage dynamicly?

Was it helpful?

Solution

Like this, as with any other templated control:

(RadPageView2.FindControl("Label2") as Label).Text = DateTime.Now.ToString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top