Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Index was out of range.

$
0
0

hey all

when i try to select command the following error comes in my code

ERROR

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

CODE

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DepartmentSupervisorInfo.DeleteDeptSupervisor(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));
                GridView1.DataSource = DepartmentSupervisorInfo.getDeptSupervisor();
                GridView1.DataBind();
            }
            else if (e.CommandName == "Select")
            {
                DataSet ds = DepartmentSupervisorInfo.getDeptSupervisorbyID(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));
                Hdnfld_deptsupid.Value = ds.Tables[0].Rows[0]["DepartmentSupervisorID"].ToString();
                Dd_supDepid.DataValueField = ds.Tables[0].Rows[0]["DepartmentID"].ToString();
                dd_supEmpid.DataValueField = ds.Tables[0].Rows[0]["EmployeeID"].ToString();
           }
        }


ERROR IN THIS LINE

                DataSet ds = DepartmentSupervisorInfo.getDeptSupervisorbyID(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));




Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>