Get User Data from Dynamic Control in RadWindow

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 01 Oct 2014 Link to this post

    Hello,

    I am working on a project with a RadWindow.
    Controls are added dynamically to the RadWindow. (TextBox, radioButton CheckBox etc.)
    The user can enter data into the dynamic controls. 

    My ASPX code::
    <telerik:RadWindow runat="server" ID="RadWindow2">
                            <ContentTemplate>
                                <telerik:RadAjaxPanel ID="MyPopUp_RadAjaxPanel1" runat="server" Width="90%"></telerik:RadAjaxPanel>
                                <asp:UpdatePanel ID="Updatepanel1" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:Button ID="Button_Ajax" Text="Click for AJAX" runat="server" OnClick="Button_Ajax_Click" />
                                        <br />
                                        <asp:Label ID="Label1" Text="I will be updated" runat="server" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                        </telerik:RadWindow>
     
      <telerik:RadButton ID="btn_win2" runat="server" Text="win 2">
                        </telerik:RadButton>

    VB.NET:
       Protected Sub btn_win2_Click(sender As Object, e As EventArgs) Handles btn_win2.Click
           Dim lbl As Label = New Label()
           Dim txt As TextBox = New TextBox()
           txt.ID = "txb_win2"
           lbl.ID = "lbl_win2"
           lbl.Text = "new lbl"
           
           MyPopUp_RadAjaxPanel1.Controls.Add(lbl)
           MyPopUp_RadAjaxPanel1.Controls.Add(txt)
           RadWindow2.VisibleOnPageLoad = True
           'RadWindow2.Width = 500
           'RadWindow2.Height = 300
           RadWindow2.Modal = True
           RadWindow2.CenterIfModal = True
       End Sub
     
    Protected Sub Button_Ajax_Click(sender As Object, e As EventArgs)
           RadWindow2.VisibleOnPageLoad = False
           lbl_NewUserData.Text = ""
           'Dim panel As RadAjaxPanel = TryCast(RadWindow2.ContentContainer.FindControl("MyPopUp_RadAjaxPanel1"), RadAjaxPanel)
           For Each ct In RadAjaxPanel1.Controls
               lbl_NewUserData.Text += ct.ToString() + vbCrLf
           Next
     
       End Sub


    How can I access the controls and the data which the user entered?
    I want to retrieve this information when the user clicks a button.

    Thanks,

    Daniel.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 02 Oct 2014 Link to this post

    Hello Daniel,

    Her are some resources that should help you with this:

    I hope this helps get you started.


    Regards,

    Marin Bratanov
    Telerik
     

    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top