datagridview - ASP.net GridView Handle Sorting -


i have following , i'm not sure how implement sorting function on gridview? data , paging work fine. not sure how handle sorting method? want sort columns asc , desc.

 public partial class inlinksauthgrid : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         registerasynctask(new pageasynctask(loadsomedata));     }      public async task loadsomedata()     {         try         {             var client = new webclient();             client.credentials = new networkcredential("test", "test");             var myinlinks = client.downloadstringtaskasync("http://inlink-xxxxxx.net:5000/inlinks");              await task.whenall(myinlinks);             var links = jsonconvert.deserializeobject<rootobject>(await myinlinks);              gridview1.datasource = links.inlinks;             gridview1.databind();         }         catch (exception ex)         {             //todo:         }     }      protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e)     {         gridview1.pageindex = e.newpageindex;     }      protected void gridview1_sorting(object sender, gridviewsorteventargs e)     {         // do here?     }      public class rootobject     {         public inlink[] inlinks { get; set; }     }      public class inlink     {         public string clicks { get; set; }         public string email { get; set; }         public string ip { get; set; }         public string keyword { get; set; }         public string timestamp { get; set; }         public string title { get; set; }         public string url { get; set; }     } }   <asp:gridview id="gridview1" runat="server" allowpaging="true" width="900" onpageindexchanging="gridview1_pageindexchanging" onsorting="gridview1_sorting" allowsorting="true"></asp:gridview> 

everything works have no idea how sorting work? thanks!

set allowsorting property of gridview true allowsorting="true" since trying sort column asc/desc. see gridview.allowsorting property


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -