shorting in gridview
-
Hi, I am using gridview to show my data from the database. I have autoGeneratedColumns set to false but I do need the shorting properties by date. I set allowShorting to true. I have fields like date and FirstName. Is it possible that i can short either by date or FirstName both. Like whenever user select by date, it should be shorted by date and whenever user selects by FirstName, it should short accordingly. Can I be able to do that ?
suchita
-
Hi, I am using gridview to show my data from the database. I have autoGeneratedColumns set to false but I do need the shorting properties by date. I set allowShorting to true. I have fields like date and FirstName. Is it possible that i can short either by date or FirstName both. Like whenever user select by date, it should be shorted by date and whenever user selects by FirstName, it should short accordingly. Can I be able to do that ?
suchita
The GridView class has a Sort method, so you can easily sort programmatically. What you need to do is choose a way for the user to request the different ways of sorting you want; maybe add a few buttons? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
The GridView class has a Sort method, so you can easily sort programmatically. What you need to do is choose a way for the user to request the different ways of sorting you want; maybe add a few buttons? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?
suchita
-
Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?
suchita
I'm somewhat familiar with DataGridView (in WinForms), not with DataGrid. However, have a look at DataGridColumn.SortExpression, I think it is the key to what you want. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?
suchita
SayamiSuchi wrote:
, then when user clicks ID, it should sort with ID and when user clicks Name
Its rally a good thing to implement.You Have to handle programatically..! may be the below article may help..! http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns.aspx If u have any more problems let me know:thumbsup:
LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.
-
SayamiSuchi wrote:
, then when user clicks ID, it should sort with ID and when user clicks Name
Its rally a good thing to implement.You Have to handle programatically..! may be the below article may help..! http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns.aspx If u have any more problems let me know:thumbsup:
LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.