Posted on 2006-11-09
hi all... i am using this section of code to capture a row cell that is clicked by the user...
public void DataGridID_ItemDataBound(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
int index = Convert.ToInt32(e.CommandArgument);
// Retrieve the row that contains the button clicked by the user from the Rows collection.
GridViewRow row = GridView1.Rows[index];
l = int.Parse(row.Cells.Text); //Get id
the problem is that when i add sorting and paging to the the grid via the "smart tag" the following line "int index = Convert.ToInt32(e.CommandArgument);" catches the column value which is a string and errors out. What is the correct way to go about paging and sorting my grid using the following code i have posted.