Click here to Skip to main content
15,917,177 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I Created a TextBox Control in asp.net at run time i want use that control data in my program and i want store it in data base how can i do this
TextBox t=new TextBox();
Form1.Controls.Add(t);
t.Id="txtBox";
Posted

1 solution

Try this in Button Click event:
C#
public void button_click(object sender, EventArgs e)
{
 TextBox txt = (TextBox)form1.FindControl("txtBox");
  var x = t.Text
 }
 
Share this answer
 
Comments
KGBRS 10-Oct-14 23:36pm    
I already tried this one but Output is not getting
Error Message object reference is not set

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900