Datagrid paging question

Discussion in 'ASP .Net Web Controls' started by JK, Oct 3, 2004.

  1. JK

    JK Guest

    Hi,

    I use a datagrid and make use of paging. To add new records I use a stored
    procedure in SQL server, which returns the unique ID of the new record. This
    works well, but how can I make the datagrid automatically display (and
    highlight) the newly added row (how do I retreive the page number of the new
    row)?

    Thanks for any help,

    Joost
     
    JK, Oct 3, 2004
    #1
    1. Advertising

  2. JK

    ranganh Guest

    Hi,

    What you can do is to use a Dataview of your dataset and sort by the unique
    id such that the latest added record is displayed the first.



    "JK" wrote:

    > Hi,
    >
    > I use a datagrid and make use of paging. To add new records I use a stored
    > procedure in SQL server, which returns the unique ID of the new record. This
    > works well, but how can I make the datagrid automatically display (and
    > highlight) the newly added row (how do I retreive the page number of the new
    > row)?
    >
    > Thanks for any help,
    >
    > Joost
    >
    >
    >
     
    ranganh, Oct 3, 2004
    #2
    1. Advertising

  3. JK

    JK Guest

    Thanks for your reply. yes, this could be a solution indeed, but I really
    need to keep my alphabetic sorting order, any other ideas?

    Joost

    "ranganh" <> schreef in bericht
    news:...
    > Hi,
    >
    > What you can do is to use a Dataview of your dataset and sort by the

    unique
    > id such that the latest added record is displayed the first.
    >
    >
    >
    > "JK" wrote:
    >
    > > Hi,
    > >
    > > I use a datagrid and make use of paging. To add new records I use a

    stored
    > > procedure in SQL server, which returns the unique ID of the new record.

    This
    > > works well, but how can I make the datagrid automatically display (and
    > > highlight) the newly added row (how do I retreive the page number of the

    new
    > > row)?
    > >
    > > Thanks for any help,
    > >
    > > Joost
    > >
    > >
    > >
     
    JK, Oct 4, 2004
    #3
  4. If your DataTable has a uniqe key constraint, you could find your newly
    added row and check it's index in the DataTable.Rows collections. And
    compute the page from that?

    --
    RobertK
    { Clever? No just smart. }

    "JK" <> wrote in message
    news:cjqpod$fg9$...
    > Thanks for your reply. yes, this could be a solution indeed, but I really
    > need to keep my alphabetic sorting order, any other ideas?
    >
    > Joost
    >
    > "ranganh" <> schreef in bericht
    > news:...
    > > Hi,
    > >
    > > What you can do is to use a Dataview of your dataset and sort by the

    > unique
    > > id such that the latest added record is displayed the first.
    > >
    > >
    > >
    > > "JK" wrote:
    > >
    > > > Hi,
    > > >
    > > > I use a datagrid and make use of paging. To add new records I use a

    > stored
    > > > procedure in SQL server, which returns the unique ID of the new

    record.
    > This
    > > > works well, but how can I make the datagrid automatically display (and
    > > > highlight) the newly added row (how do I retreive the page number of

    the
    > new
    > > > row)?
    > > >
    > > > Thanks for any help,
    > > >
    > > > Joost
    > > >
    > > >
    > > >

    >
    >
     
    Robert Koritnik, Oct 4, 2004
    #4
  5. JK

    JK Guest

    Hi

    How would that work?

    Dim myrow As DataRow = myDS.Tables(0).Rows.Find(11) ???

    Where 11 is the primary key of the added row and MyDS is a dataset

    How do I get the index of this row? Or is this not the way to do it?

    Thanks

    Joost



    "Robert Koritnik" <> schreef in bericht
    news:...
    > If your DataTable has a uniqe key constraint, you could find your newly
    > added row and check it's index in the DataTable.Rows collections. And
    > compute the page from that?
    >
    > --
    > RobertK
    > { Clever? No just smart. }
    >
    > "JK" <> wrote in message
    > news:cjqpod$fg9$...
    > > Thanks for your reply. yes, this could be a solution indeed, but I

    really
    > > need to keep my alphabetic sorting order, any other ideas?
    > >
    > > Joost
    > >
    > > "ranganh" <> schreef in bericht
    > > news:...
    > > > Hi,
    > > >
    > > > What you can do is to use a Dataview of your dataset and sort by the

    > > unique
    > > > id such that the latest added record is displayed the first.
    > > >
    > > >
    > > >
    > > > "JK" wrote:
    > > >
    > > > > Hi,
    > > > >
    > > > > I use a datagrid and make use of paging. To add new records I use a

    > > stored
    > > > > procedure in SQL server, which returns the unique ID of the new

    > record.
    > > This
    > > > > works well, but how can I make the datagrid automatically display

    (and
    > > > > highlight) the newly added row (how do I retreive the page number of

    > the
    > > new
    > > > > row)?
    > > > >
    > > > > Thanks for any help,
    > > > >
    > > > > Joost
    > > > >
    > > > >
    > > > >

    > >
    > >

    >
    >
     
    JK, Oct 7, 2004
    #5
    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. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,869
    Scott Allen
    Oct 8, 2004
  2. Roger
    Replies:
    0
    Views:
    981
    Roger
    Dec 28, 2004
  3. wh1974
    Replies:
    0
    Views:
    2,492
    wh1974
    Jan 12, 2005
  4. Red
    Replies:
    1
    Views:
    769
  5. Green Start Button

    DataGrid.Items.Count and DataGrid Paging...

    Green Start Button, Aug 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,881
    agravar
    Aug 2, 2006
Loading...

Share This Page