Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  {
      if (!e.CommandName.Equals("Page"))
      {

          if (e.CommandName.Equals("cmdViewDetails"))
          {
              Int32 index = Convert.ToInt32(e.CommandArgument);

              HiddenField hd =(HiddenField)GridView1.Rows[index].FindControl("HiddenField1");
              Int64 cid = Convert.ToInt64(hd.Value);
              Response.Redirect("ViewCProfile.aspx?cid=" + cid);
          }
      }
  }
Posted
Comments
pradiprenushe 3-Dec-14 7:16am    
show you grid source. How you have set command argument?
pradiprenushe 3-Dec-14 7:18am    
YOu index value must be >= 0 and less than grid row count

1 solution

The error message is pretty clear: index value is out of range, your GridView has not such row.
You should use a debugger to get more insight.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900