R
Robert Warnestam
Hi,
When switching from using a DataGrid to a GridView a run into a problem.
I want to show a list of users which I receive from a business object.
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Get a list of all users. (a dataset with fields; UserID, FirstName+++)
DataSet users = TapUser.GetAllUsers();
// Set the datasource and the primary key
GridView1.DataSource = users;
GridView1.DataKeyNames = new string[] {"UserID"};
GridView1.DataBind();
}
}
The problem is that I receive the following error message "Index was outside the bounds
of the array."
What am I doing wrong?
Thanks
Robert Warnestam
When switching from using a DataGrid to a GridView a run into a problem.
I want to show a list of users which I receive from a business object.
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Get a list of all users. (a dataset with fields; UserID, FirstName+++)
DataSet users = TapUser.GetAllUsers();
// Set the datasource and the primary key
GridView1.DataSource = users;
GridView1.DataKeyNames = new string[] {"UserID"};
GridView1.DataBind();
}
}
The problem is that I receive the following error message "Index was outside the bounds
of the array."
What am I doing wrong?
Thanks
Robert Warnestam