Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Shuffling rows in a GridView

Reply
Thread Tools

Shuffling rows in a GridView

 
 
justin
Guest
Posts: n/a
 
      09-01-2006
One of the gridviews i'm using now apparently needs to have the added
functionality of re-arranging the order of the records it's
representing. These records have a priority field which the dataset
gets sorted on and I thought the quickest way to do this would be to
add "move up", "move down" buttons next to the grid which would shuffle
the rows up and down by swapping their priority field values and
updating.

At least that seemed to be the quickest way before I spent a day
pouring through documentation trying to find a way to get at the
dataset of the gridview with no success whatsoever. Thing's locked up
tighter than a duck's. Is there any way on God's green earth to access
the data of a gridview? Or is there a better way to do this, you see it
all the time with listboxes I'd hoped I could get the gridview to play
along...

 
Reply With Quote
 
 
 
 
justin
Guest
Posts: n/a
 
      09-05-2006
Thanks for the reply Alvin,
Yes a listbox would be a far more clever solution but the existing page
uses the gridview's edit functionality so I can't really change it to a
listbox. And you're right, you just have to re-order the dataset. I
just can't find any way to prise that dataset out of the gridview, or
the objectdatasource that i'm using for it. There doesn't seem to be
any way to get to it.

Alvin Bruney [MVP] wrote:
> I don't believe this is built in simply because row order is not usually an
> overriding concern. But's it's really easy to do. Just re-order the
> datasource, dataview, or dataset and rebind.
>
> On second thought, if you need flexibility in row ordering, you should be
> using a listbox and not a gridview.
>
> --
> ________________________
> Warm regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Professional VSTO.NET - Wrox/Wiley
> The O.W.C. Black Book with .NET
> www.lulu.com/owc, Amazon
> Blog: http://www.msmvps.com/blogs/alvin
> -------------------------------------------------------
>
>
> "justin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > One of the gridviews i'm using now apparently needs to have the added
> > functionality of re-arranging the order of the records it's
> > representing. These records have a priority field which the dataset
> > gets sorted on and I thought the quickest way to do this would be to
> > add "move up", "move down" buttons next to the grid which would shuffle
> > the rows up and down by swapping their priority field values and
> > updating.
> >
> > At least that seemed to be the quickest way before I spent a day
> > pouring through documentation trying to find a way to get at the
> > dataset of the gridview with no success whatsoever. Thing's locked up
> > tighter than a duck's. Is there any way on God's green earth to access
> > the data of a gridview? Or is there a better way to do this, you see it
> > all the time with listboxes I'd hoped I could get the gridview to play
> > along...
> >


 
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
Hide the Gridview Rows and Header rows in Button click VijayRama ASP .Net 2 10-12-2009 01:58 PM
Shuffling rows in a GridView justin ASP .Net 3 09-14-2006 11:27 PM
shuffling elements of a list greenflame Python 22 06-02-2006 11:50 AM
random shuffling glowfire C++ 16 02-23-2005 01:26 PM
sorting and shuffling array SilverWolf C Programming 3 10-14-2003 05:11 AM



Advertisments