Posts

Showing posts from February, 2010

Sorting Gridview columns in Asp .NET

I like the gridview control most, to display the data of the database table at the webpage. It has so many features and extensions, which makes programming easier and interesting. In this article I will show you the method to sort gridview columns. First of all, define the grid view control as follows: (You can have your own colors and formats, but do not forget to mention AllowSorting ="True" and mention the function name in onsorting property as onsorting ="OnSort” . Onsort is the name of my function, you can have some other name of the function) < asp : GridView   ID ="mygrid"   runat ="server"   CellPadding ="4"   ForeColor ="#333333"   AllowPaging ="True"   AllowSorting ="True"   AutoGenerateColumns ="False" PageSize ="15"   style ="position: static; clear: both; display: block;"   onsorting ="OnSort">   < Columns > < asp : BoundField   DataField =&