This is my code snippet..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadMyGrid();
}
}
public void loadMyGrid()
{
string[] stuff = new string[] {"Mohan","Arul Prakash","Lakshman","Ravindran","Senthil","Nagaraj","Bala","Suresh","Ashok" };
//GridView1.Columns[0].HeaderText = "My Customized Grid Control";
GridView1.DataSource = stuff;
GridView1.DataBind();
}
}
When my above code is executed, it is displaying the following error.
"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"
Can anyone there to help me???
Thanks in advance...
Anonymous User
22-Dec-2011Hi Mohan Kumar,
I had modified your code which works as you want..
Please check this code and let me know if further any problem.