Hi all,
protected void update_Status_Click(object sender, EventArgs e)
{
List<int> id = new List<int>();
foreach (GridViewRow row in GridView1.Rows)
{
int i = row.RowIndex;
CheckBox cb = (CheckBox)row.FindControl("SelectCashout");
if (cb != null && cb.Checked)
{
if (GridView1.Rows[i].Cells[2].Text == "Requested")
{
int x = Convert.ToInt32(GridView1.Rows[i].Cells[0].Text);
id.Add(x);
}
}
}
}
When I debug it I am getting "GridView1.Rows[i].Cells[2].Text" value as empty string.
This is not a Gridview event, it is button event out side the gridview.
I tried
row.Cells[2].Text
it doesn't help. At the moment gridview showing 10 rows with all the data in all the columns.
It's not Edit/Update button on Gridview.
I am giving option to the user to select which rows he wants to update.
Based on his selection through checkbox I have to update just one cell value in the gridview and collect primary key of that row in the table so I will update datasource at backend(That code I haven't included)
Hope you understood. updating one cell value is not mandatory because I am updating datasource and I can rebind it. Collecting that row's Primary key(Datasource Table's) is
"GridView1.Rows[i].Cells[0].Text" important to update database.
What am I missing here? any help thanks