Can any one tell what i have to modify in the code
I have written code to add rows to the grid view dynamically at run time but the text on button Add is changing to the text on Delete button can any one have a look over the code and tell what i have to modify..

raghu vPosted Jun 2, 2011, 8:30 AM
in the function addnewrowtogrid
try with the following code
drCurrentRow["Add/Delete"] = "Add";
drCurrentRow["Add/Delete"] = "Delete";
and in setpreviousdata
use the code
box2.Text = "Add";
box3.Text = "Delete";
Dorababu MekaPosted Jun 2, 2011, 8:34 AM
Posted Jun 2, 2011, 8:26 AM
Try this
box2.Text = "Add";
box3.Text = "Delete";
Dorababu MekaPosted Jun 2, 2011, 8:23 AM
Dorababu MekaPosted Jun 2, 2011, 8:19 AM
Posted Jun 2, 2011, 8:17 AM
Check your datatable structure also...
box2.Text = dt.Rows[i]["Add"].ToString();
box3.Text = dt.Rows[i]["Delete"].ToString();
Dorababu MekaPosted Jun 2, 2011, 8:16 AM
Posted Jun 2, 2011, 7:59 AM
In AddNewRowToGrid function ,
the following code is wrong.
box2.Text = dt.Rows[i]["Add/Delete"].ToString();
box3.Text = dt.Rows[i]["Add/Delete"].ToString();
Here you're trying to use the same column value as two different varaible. There box3 value over writtern in box2 because
dt.Rows[i]["Add/Delete"].ToString().
So, change your logic here.