Saving gridview data on postback

Joined
Jul 17, 2010
Messages
2
Reaction score
0
Hi,

In my application, I have a gridview which is visible with a blank row on Page_Load. The GV has 4 columns of which the first column is an editable textbox. The rest 3 are bound fields. When I enter a valid ID in the textbox cell and hit the Enter key(TextChanged Event), the rest of the 3 fields are bound and a new empty row is created below this row. But my problem is , when I enter the second data and hit Enter, the first row is lost and is replaced with this second row( Datatable not holding values on Postback). Kindly help...!!!



protected void TextBox1_TextChanged(object sender, EventArgs e)

{
if (ID valid and data returned)

{
Addnewemptyrow; //For next input
Bind data to current row;
}
if(Invalid ID and data not returned)
{
Cells[1].Text = ""; // Clear the current row values(Make it as a new row)
Cells[2].Text = "";
Cells[3].Text = "";

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top