DataGrid problems

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
 
S

Saravana

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.
 
I

Ingeborg

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
 
L

Luke Zhang [MSFT]

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top