Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to store dynamically created textbox values in sqlserver?
Posted
Updated 11-Jan-11 0:05am
v2

Have a look here for more info:
http://weblogs.asp.net/ksamaschke/archive/2003/04/27/6098.aspx[^]

Good luck!
 
Share this answer
 
Comments
Abhijit Jana 11-Jan-11 13:11pm    
Good Ref. Link ! Have my 5 !!!
Hi,

While dealing with Dynamic TextBox Controls in ASP.NET you have to consider few things. First, In which event you are creating the control and second are you adding them in Control Hierarchy or not.
If you check the ASP.NET Page Lifecycle, Before Page_Load, there are few methods PreInit(), Init(), LoadViewStateData() and LoadPostBackData() . Most of the developer create dynamic Controls in Page_Load() or In some event like Button Click. But those control will never get the data from LoadViewState() or LoadPostBackData() as control are been created after Init() they are not part of the control hiearchy. ASP.NET Loads Postback and View State data based on the control hierarchy tree which are created in init() events.
So, you have to make sure you are creating the control in proper place. I hope this will helps you to know the internals and you can dig dive!

This article while help you to deep inside of ASP.NET Text box, which I refered many times :) ViewState and Postback[^]

Cheers!!
 
Share this answer
 
Comments
Sandesh M Patil 11-Jan-11 12:52pm    
Nicely described +5 from me
Abhijit Jana 11-Jan-11 13:20pm    
Thanks SMP !
Pranay Rana 11-Jan-11 22:54pm    
have 5 - well explained
TweakBird 12-Jan-11 3:57am    
Have 5+ Good answer.
Hiren solanki 12-Jan-11 4:01am    
I was not clear with what OP asking so you need to look at third para also.
If you're creating a dynamic textbox then by versa you can also get a value from it back.

Like wise if you can create like

C#
Textbox tx = new Textbox();
Page.Controls.Add(tx);


Then versa it's possible to find it back again from page too

C#
Textbox tx = (TextBox)Page.FindControls(tx);
if(tx != null)
{
string TextValue = tx.Text; // the value you want actually.
}


Store this value to SQL as per requirement.

Or just be more clear with your intention, share snippets, Show some effort, spend some more time on questioning.

People are here lazier than a lazy questioner!

[Edit]
Added snipeet to spoon feed as abhijit said
[/Edit]
 
Share this answer
 
v3
Comments
Dalek Dave 11-Jan-11 6:22am    
Just tidied it up a bit mate, +5 for good answer.
Abhijit Jana 11-Jan-11 13:05pm    
Do you think your answer does make any sense ? Specially First line "If you're creating a dynamic textbox then by versa you can also get a value from it back" .
My suggestion to you, before answering any questions, try to think why the OP asking the question or Ask for clarification multiple times if you are not clear.
Hiren solanki 12-Jan-11 4:01am    
So Can't you see third para. for the same ?

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