Wednesday, March 7, 2012

How to create a dynamic control

We can create the dynamic control in the Page_Init() event or Page_Load() event

protected void Page_Load(object sender, EventArgs e)
        TextBox dynamicTextBox = new TextBox();
        dynamicTextBox.ID = "DynamicTextBox";
        dynamicTextBox.AutoPostBack = true;
        dynamicTextBox.Text = "InitData";
        dynamicTextBox.TextChanged += new EventHandler(dynamicTextBox_TextChanged);
    void dynamicTextBox_TextChanged(object sender, EventArgs e)

No comments:

Post a Comment