Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

后端 未结 2 2006
死守一世寂寞
死守一世寂寞 2021-01-27 10:07

When i am click on update button i got this error my update click event

protected void btnUpdate_Click(object sender, CommandEventArgs e)
{
    int idx = Conve         


        
2条回答
  •  再見小時候
    2021-01-27 10:53

    How many rows do you have?

    Try this:

    int idx = Convert.ToInt32(e.CommandArgument);
    
    if (idx < gvResTasks.Rows.Count)
    {
        GridViewRow gr = gvResTasks.Rows[idx];
    }
    

    Also, can you provide the btnUpdate ASPX code?

提交回复
热议问题