How to read the value from controls created at runtime? (sample code included)

  1. #1

    How to read the value from controls created at runtime? (sample code included)

    Hi guys, I need to be able to add composite items on-demand during runtime and on a DirectEvent loop through them and read the values inside the controls contained by the composite field but I'm stuck at the reading the values back portion, could you please copy/paste my code and let me know what's the correct approach to do this?
    Thank you,

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        protected void btAdd_Click(object sender, DirectEventArgs e)
            Ext.Net.CompositeField newField = new Ext.Net.CompositeField();
            Ext.Net.ComboBox newCombo = new Ext.Net.ComboBox();
            newCombo.Width = new Unit(125);
            newCombo.Margins = "5 5 5 5";
            Ext.Net.TextField edtText = new Ext.Net.TextField();
            edtText.Width = new Unit(175);
            edtText.Margins = "5 5 5 5";
            edtText.Text = DateTime.Now.ToString();
            X.Msg.Notify("Event", "Added control...").Show();
        protected void btCheck_Click(object sender, DirectEventArgs e)
            X.Msg.Notify("Items", Panel1.Items.Count).Show();
    <html xmlns="">
    <head runat="server">
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        <ext:Panel ID="Panel1" runat="server" Height="300" Title="Title" AutoScroll="true">
                <ext:Toolbar ID="Toolbar1" runat="server">
                        <ext:Button ID="btAdd" runat="server" Text="Add Composite Items" Icon="Add">
                                <Click OnEvent="btAdd_Click">
                        <ext:Button ID="btCheck" runat="server" Text="How may items inside Panel1?" Icon="Help">
                                <Click OnEvent="btCheck_Click" ViewStateMode="Enabled">
  2. #2

Similar Threads

  1. Replies: 1
    Last Post: May 09, 2012, 7:08 PM
  2. Replies: 10
    Last Post: Aug 01, 2011, 1:58 PM
  3. [CLOSED] get value of controls created in code-behind
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Sep 30, 2010, 3:07 PM
  4. Replies: 6
    Last Post: Jun 18, 2010, 4:23 PM
  5. [CLOSED] [1.0] CommandColumn created runtime does not appear
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 30, 2010, 5:02 PM

Posting Permissions