You will now have a gridview with a column that cointains a button "btnDelete".
You need to create an event for the btnDelete_Click and on it add the code I posted.
The code will get the row id from the row where the button was clicked, or well you can actually obtain any value from the datasource related to the grid, you just need to set the value position that you need:
string id = table.Rows[grdRow.RowIndex].ItemArray[
0].ToString();
In the explample, the row id is the first value from the query in the SqlDataSource2, meaning, the position 0.
You need to create an event for the btnDelete_Click and on it add the code I posted.
#
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
#
{
#
ImageButton Button1 = (ImageButton)sender;
#
GridViewRow grdRow = (GridViewRow)Button1.Parent.Parent;
#
DataSourceSelectArguments args = new DataSourceSelectArguments();
#
DataView view = (DataView)this.SqlDataSource2.Select(args);
#
DataTable table = view.ToTable();
#
string id = table.Rows[grdRow.RowIndex].ItemArray[0].ToString();
#
string name= table.Rows[grdRow.RowIndex].ItemArray[1].ToString();
}
Let me know how it went, I can send you an app if you need.