|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Shuffling rows in a GridViewOne 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... 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. -- Show quoteHide quote________________________ 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" <justinloren***@gmail.com> wrote in message news:1157144278.547454.192240@i3g2000cwc.googlegroups.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... > 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: Show quoteHide quote > 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" <justinloren***@gmail.com> wrote in message > news:1157144278.547454.192240@i3g2000cwc.googlegroups.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... > > I think you can get more specialized help for this in the www.asp.net forum.
-- Show quoteHide quote________________________ 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" <justinloren***@gmail.com> wrote in message news:1157476426.291379.222550@i3g2000cwc.googlegroups.com... > 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" <justinloren***@gmail.com> wrote in message >> news:1157144278.547454.192240@i3g2000cwc.googlegroups.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... >> > >
Really Stuck on a Canlendar Control PLEASE HELP!!!
Javascript disabled Menu control Accessibility Events for programatically added controls UserControl values lost on PostBack I am trying to hide some textboxes, dropdownlists and labels in datalist Video Player in browser... how do I do? DetailsView Issue. Data diagrams - like the ones in office (excel, word, et al.) CustomWeb Controls and Events I want to know what is a Functional Specification Document? |
|||||||||||||||||||||||