DataGrid problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ingeborg

    DataGrid problems

    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(ob ject source,
    System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
    {
    anyGrid.EditIte mIndex = e.Item.ItemInde x;
    anyGrid.DataBin d();
    }

    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

    #2
    Re: DataGrid problems

    You need to set the datasouce before binding, change your code like this

    anyGrid.EditIte mIndex = e.Item.ItemInde x;
    anyGrid.DataSou rce = anyDataSet
    anyGrid.DataBin d();

    I hope this helps.
    --
    Saravana
    Microsoft India Community Star,
    MCAD,SE,SD,DBA.


    "Ingeborg" <nobody@nowhere .net> wrote in message
    news:0bf101c33d 14$40690310$a00 1280a@phx.gbl.. .[color=blue]
    > 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(ob ject source,
    > System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
    > {
    > anyGrid.EditIte mIndex = e.Item.ItemInde x;
    > anyGrid.DataBin d();
    > }
    >
    > 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
    >
    >
    >[/color]


    Comment

    • Ingeborg

      #3
      Re: DataGrid problems

      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
      [color=blue]
      >-----Original Message-----
      >You need to set the datasouce before binding, change your[/color]
      code like this[color=blue]
      >
      > anyGrid.EditIte mIndex = e.Item.ItemInde x;
      > anyGrid.DataSou rce = anyDataSet
      > anyGrid.DataBin d();
      >
      >I hope this helps.
      >--
      >Saravana
      >Microsoft India Community Star,
      >MCAD,SE,SD,DBA .
      >
      >
      >"Ingeborg" <nobody@nowhere .net> wrote in message
      >news:0bf101c33 d14$40690310$a0 01280a@phx.gbl. ..[color=green]
      >> Hi.
      >>
      >> I have a DataGrid, and it works fine, but when I push[/color][/color]
      the[color=blue][color=green]
      >> edit button for a common edit command, like this:
      >>
      >> private void institutionGrid _EditCommand(ob ject source,
      >> System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
      >> {
      >> anyGrid.EditIte mIndex = e.Item.ItemInde x;
      >> anyGrid.DataBin d();
      >> }
      >>
      >> the DataGrid looses all rows, event if the dataset[/color][/color]
      hasn't[color=blue][color=green]
      >> 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
      >>
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Luke Zhang [MSFT]

        #4
        RE: DataGrid problems

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

        Comment

        Working...