Reputation: 4721
I know this question has been answered many a times on this site but its bit different. Please see my issue
I want to delete row from the gridview
by the below code:-
protected void GrdQualification_DeleteCommand(object sender, Obout.Grid.GridRecordEventArgs e)
{
if (Session["DtFilldata"] != null)
{
DtFilldata = (DataTable)Session["DtFilldata"];
}
else
{
BindDatatable();
}
DataRow[] advRow = DtFilldata.Select("Q_SRNO=" + Convert.ToString(e.Record["Q_SRNO"]));
DtFilldata.Rows.Remove(advRow[0]);
AddToViewState();
}
But I am getting error as
Index was outside the bounds of the array
I checked links from the site but it didn't helped me.
Please suggest what Is wrong here
Upvotes: 0
Views: 805
Reputation: 4721
Actually, while debugging I saw that AddToViewState()
function was giving me the issue.
As it was making the function call again so it was going Out of Index
. So I removed that and it worked as required.
Upvotes: 1