Please solve this problem.. very urgent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Al

I am new to asp.net frame work. My requirement is :
1. A textbox with id 'TEXTBOX1' is created on click event of BUTTON1 dynamically.
2. On the click event of another button 'BUTTON2', i am successful in displaying the TEXT of TEXTBOX1 in
let's say some label; but the TEXTBOX1 ( which was created & visible on the page after clicking of BUTTON1) gets disappeared
This is because BUTTON1's click event will not be triggered when i click on BUTTON2
What is the solution for this
 
Everyone's problem is urgent.

An ASPX Page lives on the server for a matter of milliseconds. Every
PostBack or Request for that Page re-creates the Page class over again. If
you add a Control dynamically during a PostBack, you must re-add that
Control with every PostBack in order for it to "remain".

--

HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

sri said:
Hi All

I am new to asp.net frame work. My requirement is :
1. A textbox with id 'TEXTBOX1' is created on click event of BUTTON1 dynamically.
2. On the click event of another button 'BUTTON2', i am successful in
displaying the TEXT of TEXTBOX1 in
let's say some label; but the TEXTBOX1 ( which was created & visible on
the page after clicking of BUTTON1) gets disappeared.
 
kevin ... thanx for the reply ..

can u give some example ..

problem faced is

Dim txtbox As New TextBox()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PlaceHolder1.Controls.Add(New LiteralControl("Entry "))
PlaceHolder1.Controls.Add(txtbox)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' now here i want to display the same 'txtbox' created in Button1_Click along with the value
' entered in it
End Sub

can u throw some light on this problem .. ???
 
Back
Top