Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created dynamic textboxes. i have got id of that textbox...i want to insert text which entered in textbox into database..how to do that???
Posted

All the control values are present in Request object. You can fetch value from Request object using control name (UniqueID) not id. Syntax is given below

C#
var textBoxValue = Request[txtBox.UniqueID];


Please let me know if this does not help.
 
Share this answer
 
v2
It depends on where you are creating the controls. Simple solution which I ever know : Create controls inside Page_PreInit Event.

Page_PreInit event will render your controls easily and store the ViewState of your controls.
Then you can easily find the controls created dynamically using the following code:
C#
TextBox TextBox1= (TextBox)Page.FindControl("TextBox");

If you need little more help or guideline while creating the controls then refer the links for similar articles:



--Amit
 
Share this answer
 
v2

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