DataGrid problems

  • Thread starter Thread starter Ingeborg
  • Start date Start date
I

Ingeborg

Hi.

I have a DataGrid, and it works fine, but when I push the
edit button for a common edit command, like this:

private void institutionGrid_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
anyGrid.EditItemIndex = e.Item.ItemIndex;
anyGrid.DataBind();
}

the DataGrid looses all rows, event if the dataset hasn't
changed and is (supposed to be) stored in the session
object and re-read at Page_Load.

I really need some help with this.

Thanks in advance,
Ingeborg
 
You need to set the datasouce before binding, change your code like this

anyGrid.EditItemIndex = e.Item.ItemIndex;
anyGrid.DataSource = anyDataSet
anyGrid.DataBind();

I hope this helps.
 
Thanks for your advice.

This didn't help though.

I am using Visual Studio .NET 2002 and the 1.0 framework,
maybe is could be some error there, because the DataGrid
behavior seems a bit random to me... I really don't know.


Ingeborg
 
Have you tried not to store the dataset in a session variant? For example,
just drag a DataSet component onto the webform?

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top