DataGrid problems

Discussion in 'ASP .Net' started by Ingeborg, Jun 28, 2003.

  1. Ingeborg

    Ingeborg Guest

    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
    Ingeborg, Jun 28, 2003
    #1
    1. Advertising

  2. Ingeborg

    Saravana Guest

    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
    >
    >
    >
    Saravana, Jun 28, 2003
    #2
    1. Advertising

  3. Ingeborg

    Ingeborg Guest

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

    >
    >
    >.
    >
    Ingeborg, Jun 28, 2003
    #3
  4. 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.)
    Luke Zhang [MSFT], Jul 1, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hrvoje Vrbanc
    Replies:
    8
    Views:
    348
    Hrvoje Vrbanc
    Aug 9, 2003
  2. Susan Baker
    Replies:
    2
    Views:
    808
    kelvSYC
    Jun 26, 2005
  3. Shelly

    Problems, problems for newbie

    Shelly, Sep 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    2,180
    Shelly
    Sep 3, 2007
  4. Andreas Klemt
    Replies:
    0
    Views:
    293
    Andreas Klemt
    Oct 8, 2003
  5. Sak Na rede
    Replies:
    0
    Views:
    416
    Sak Na rede
    Jan 30, 2009
Loading...

Share This Page