0

Hi this is Kiran kumar

How the Controls that are created dynamically in the page load will maintain their
state that means how they will preserve the values .

if anybody knows the answer please help me

thanks in advancce
regards kiran kumar

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by kiran@kumar
0

Sample.aspx

<form id="form1" runat="server">
    <div>
    
    </div>
    </form>

Sample.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        TextBox tx = new TextBox();
        tx.ID = "txt1";
        form1.Controls.Add(tx);
        Button b1 = new Button();
        b1.ID = "btn1";
        form1.Controls.Add(b1);
        b1.Click += (s, args) =>
        {
            TextBox t = (TextBox)FindControl("txt1");
            Response.Write(t.Text);
        };
    }

Read ASP.NET Page life cycle article - http://msdn.microsoft.com/en-us/library/ms178472.aspx

Edited by __avd: n/a

0

yaa i understood your code . but i want where exactly the state will be retained in
the asp.net page life cycle.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.