B
Bj?rn Scheepers via .NET 247
I'm struggling with this error for a while now.
First I'll give a shot description of what I'm doing.
I got 2 DataGrids on a webform.
1 with existing task for 1 day, and 1 that gets filled in by using a method FindFreeHours.
It's in that FindFreeHours method that i get a IndexOutOfRangeException.
FindFreeHours() searches for gaps in the task list of that day.
When it gets called for the second time, i get the error at aantal = 0 (aantal = number of).
When i comment the "aantal = 0" the error just moves to the next line.
Some code:
public void FindFreeHours()
{
DataRow dr1;
DataRow dr2;
aantal = 0;
...
}
The BindGrid() method that get's called every time befor the FindFreeHours
private void BindGrid()
{
dsCodfus = cfs.getCfData("5",huidigeDatum.ToShortDateString());
Application["dsCodfus"] = dsCodfus;
grid1.DataSource = dsCodfus.Tables[0].DefaultView;
grid1.DataBind();
}
This code comes from the Page_Load() method. It isn't in the !ispostback part because every action on the form needs an update of the dataset (a webmethod returns the tasks of @user, for @date).
I realy hope somebody could help me out here
First I'll give a shot description of what I'm doing.
I got 2 DataGrids on a webform.
1 with existing task for 1 day, and 1 that gets filled in by using a method FindFreeHours.
It's in that FindFreeHours method that i get a IndexOutOfRangeException.
FindFreeHours() searches for gaps in the task list of that day.
When it gets called for the second time, i get the error at aantal = 0 (aantal = number of).
When i comment the "aantal = 0" the error just moves to the next line.
Some code:
public void FindFreeHours()
{
DataRow dr1;
DataRow dr2;
aantal = 0;
...
}
The BindGrid() method that get's called every time befor the FindFreeHours
private void BindGrid()
{
dsCodfus = cfs.getCfData("5",huidigeDatum.ToShortDateString());
Application["dsCodfus"] = dsCodfus;
grid1.DataSource = dsCodfus.Tables[0].DefaultView;
grid1.DataBind();
}
This code comes from the Page_Load() method. It isn't in the !ispostback part because every action on the form needs an update of the dataset (a webmethod returns the tasks of @user, for @date).
I realy hope somebody could help me out here