Export selected rows of gridview to Excel or word in ASP.Net By Using 3-Tier Architecture

Posted by Priyatham under ASP.NET category on | Points: 40 | Views : 1729
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
private void SaveCheckedValues()
ArrayList userdetails = new ArrayList();
int index = -1;
foreach (GridViewRow gvrow in gvdetails.Rows)
index = (int)gvdetails.DataKeys[gvrow.RowIndex].Value;
bool result = ((CheckBox)gvrow.FindControl("chkSelect")).Checked;
// Check in the Session
if (ViewState["CHECKED_ITEMS"] != null)
userdetails = (ArrayList)ViewState["CHECKED_ITEMS"];
if (result)
if (!userdetails.Contains(index))
if (userdetails != null && userdetails.Count > 0)
ViewState["CHECKED_ITEMS"] = userdetails;

Can any one Plz help me out from this
Thanks in advance

Comments or Responses

Posted by: Satyapriyanayak on: 7/2/2013 Level:Silver | Status: [Member] [MVP] | Points: 10
Please ask the questions in forum section only.

Login to post response