Jump to content

Sorting GridView


Guest helelark
 Share

Recommended Posts

Guest helelark

Hello, I have a gridview of the columns, I am hiding the header of the gridview and creating my own header cells. (In fact I have a lot of columns and rowspan,columnspan.., but let simplify the problem) My target is to sort the grid cicking on the header cells. I add attributes to each one of the header cells as following Dim cell11 As New TableCell cell11.RowSpan = 2 cell11.Text = "Model Name" cell11.Style.Add("text-decoration", "underline") cell11.Style.Add("cursor", "hand") cell11.Style.Add("color", "navy") Now I have to add onclick attribute to the cell cell11.Attributes.Add("OnClick", "SortGridView('Model Name')") Here is my client side code: var gridViewCtlId = '<%=GridView1.ClientID%>'; function getGridViewControl() { if (null == gridViewCtl) { gridViewCtl = document.getElementById(gridViewCtlId); } } function SortGridView(colNm) { getGridViewControl(); if (null != gridViewCtl) { return gridViewCtl.sort[colNm,1]; } return null; } What is the right code in javascript functions? Thanx

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...