how to add textbox to a table at runtime and send textbox's value to database
-
hello, i am trying to find out "how to add a simple textbox to a form at runtime and then send its textvalue(whatever written in it) to a datatable made in my dadabase" is anybody can help me! thanx in advance! nitin
Add a placeholder control where you want to add the textbox then at run time create the new object of your textbox give it id and then add that textbox to the placeholder . now the control is in page you can use that value
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
hello, i am trying to find out "how to add a simple textbox to a form at runtime and then send its textvalue(whatever written in it) to a datatable made in my dadabase" is anybody can help me! thanx in advance! nitin
Nitin, sandip is right... However, you can also use "Panels" for the same protected System.Web.UI.WebControls.Panel Panel1; ... ... .... .... TextBox txt =new TextBox(); txt.ID = "textBox1"; Panel1.Controls.Add(txt); ... ... .... .... //At any point of time you can read value from this text box TextBox tempText = new TextBox() tempText = (TextBox)Panel1.FindControl("textBox1") string strValue = tempText.Text() Sreekumar P P
-
Nitin, sandip is right... However, you can also use "Panels" for the same protected System.Web.UI.WebControls.Panel Panel1; ... ... .... .... TextBox txt =new TextBox(); txt.ID = "textBox1"; Panel1.Controls.Add(txt); ... ... .... .... //At any point of time you can read value from this text box TextBox tempText = new TextBox() tempText = (TextBox)Panel1.FindControl("textBox1") string strValue = tempText.Text() Sreekumar P P
thanx sir ji, your view is very helpful 4 me but there is a prblm now... i put 2 btn on form btn1.text= add button btn2.text= insert when i click btn1 , a textbox appeared on forn but when i click btn2 the textbox disappear and nothing inserted in my database. nitin