Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have problem guys!!
i am trying to create some text boxes dependence on how many items in Drop Down List
which already exist in the page

what i need to do to insert values of those text boxes into DB SQL


can you help me with ideas?

i already did it with Jquery and Json but i need to do it with ASP.net
Posted
Updated 25-Aug-12 6:15am
v3
Comments
[no name] 25-Aug-12 9:42am    
Okay so? Connect to your database and use an INSERT query. What exactly is the problem?
Haitham tarek 25-Aug-12 10:22am    
if i click on the button insert the page go for post back before take the vales of the text boxes then i lose them

what i need to keep the values in somehow after post back to could insert them
Brandon Caruana 25-Aug-12 18:30pm    
stick this code in your page_load event.
if (!Page.IsPostBack){
// other code here
}

1 solution

Really, your best bet is to stick with AJAX and JSON, because if you create controls dynamically, you will struggle to get the values from dynamically created controls because they won't be in the control tree early enough ( before page_load ) for viewstate to be restored. It's better anyhow, why would you post back if you don't need to ?
 
Share this answer
 
Comments
Haitham tarek 25-Aug-12 10:21am    
this exactly what i did i try it with Jquery and Json and wit works now
but the thing is i needed to do it with asp like save it in session or in Veiwstate because yes if i click on the button insert the page go for oistback before take the vales of the text boxes then i lose them
but i dunno the logic of how to make it in veiwstate for E.X also i tried
to take the values of text boxes and put them in hash table using Javascript
but it just take the first text box if it was 2 i thing it not takeing the last text box i dunno why too :(
NandaKumer 25-Aug-12 12:15pm    
good answer. fived

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