Datagrid paging question

J

JK

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
 
R

ranganh

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

JK

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
 
R

Robert Koritnik

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

JK

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
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top