Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid problems

Reply
Thread Tools

DataGrid problems

 
 
Ingeborg
Guest
Posts: n/a
 
      06-28-2003
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



 
Reply With Quote
 
 
 
 
Saravana
Guest
Posts: n/a
 
      06-28-2003
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.
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.


"Ingeborg" <> wrote in message
news:0bf101c33d14$40690310$...
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Ingeborg
Guest
Posts: n/a
 
      06-28-2003
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

>-----Original Message-----
>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.
>--
>Saravana
>Microsoft India Community Star,
>MCAD,SE,SD,DBA.
>
>
>"Ingeborg" <> wrote in message
>news:0bf101c33d14$40690310$...
>> 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
>>
>>
>>

>
>
>.
>

 
Reply With Quote
 
Luke Zhang [MSFT]
Guest
Posts: n/a
 
      07-01-2003
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.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Datagrid: how cut short display of a long description in a datagrid column Brian K. Williams ASP .Net 0 03-02-2004 08:35 PM
RE: Datagrid: how cut short display of a long description in a datagrid column =?Utf-8?B?U3VyZXNo?= ASP .Net 0 03-02-2004 08:31 PM
datagrid in datagrid BK Kim ASP .Net 1 03-02-2004 06:34 AM
Call Datagrid Command column outside datagrid Dave ASP .Net 0 11-20-2003 11:11 AM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM



Advertisments