Azaad Abbas

Azaad Abbas

  • NA
  • 221
  • 40.2k

How to get selected row cell value in 'RowCommand'?

Apr 7 2015 3:43 AM
by command name iam getting 'complaintId' and also want to get 'userId' which is other cell..then how?
 
protected void gridComplaintSearch_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "CompVIEW")
{
int row = Convert.ToInt32(e.CommandArgument);
Session["compUid"] = row;
int custId = Convert.ToInt32(gridComplaintSearch.SelectedRow.Cells[4].Text); /*Here throwing an error: Object reference not set to an instance of an object.*/
Response.Write("<script> window.open( '../Update Pages/ComplaintUpdate.aspx','_blank' ); </script>");
Response.Write("<script>window.opener.location.href = window.opener.location.href </script>");
}

}

Answers (9)