Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Rows dynamically to a Gridview

Status
Not open for further replies.

CompCodeBoy

Programmer
Aug 18, 2005
33
US
This is the problem:

I got an "ADD ROW" button and a gridview. Click the "ADD ROW" button and a new gridview row is inserted with the first column as a template textbox. If I type anything in the textbox and then hit "ADD ROW" button, the textbox values are lost. What can I do to retain those values. Code sample would be appreciated. Thanks.
 
you need to persist the values between postbacks. whether that's viewstate, session, some static enumeration, or a database is up to you.

the most common scenario is to save to a database, then re-bind the datagrid after editing.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top