Problem in sorting datagrid in ASP.NET 1.1
-
hi all, I have a datagrid with all bound columns and autogenerate columns =false. The problem is the datagrid headers have not become clickable even afer i have made allow sorting=true.They become clickable only if i make autogenerate columns=true. What can be the problem???? Thanks in adv!!!
-
hi all, I have a datagrid with all bound columns and autogenerate columns =false. The problem is the datagrid headers have not become clickable even afer i have made allow sorting=true.They become clickable only if i make autogenerate columns=true. What can be the problem???? Thanks in adv!!!
Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.
[Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot
-
Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.
[Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot
Venkatesh Mookkan wrote:
Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.
I haven`t explicitly specified the sortexpression in the .aspx page. for your reference i m giving you the code Sub FillGrid() cmd = New SqlCommand cmd.Connection = con cmd.CommandText = "List_Party_Info" cmd.CommandType = CommandType.StoredProcedure sda = New SqlDataAdapter sda.SelectCommand = cmd ds = New DataSet sda.Fill(ds) CustGrid.DataSource = ds CustGrid.DataBind() Session("Data") = ds ValidateGrid() End Sub above code is used for binding the grid and the following is the sort command Private Sub CustGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles CustGrid.SortCommand Dim ds1 As DataSet = CType(Session("Data"), DataSet) Dim dv As DataView = ds1.Tables(0).DefaultView dv.Sort = e.SortExpression FillGrid() End Sub Html Code but this event doesn`t fire..Whate can be the problem???
-
Venkatesh Mookkan wrote:
Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.
I haven`t explicitly specified the sortexpression in the .aspx page. for your reference i m giving you the code Sub FillGrid() cmd = New SqlCommand cmd.Connection = con cmd.CommandText = "List_Party_Info" cmd.CommandType = CommandType.StoredProcedure sda = New SqlDataAdapter sda.SelectCommand = cmd ds = New DataSet sda.Fill(ds) CustGrid.DataSource = ds CustGrid.DataBind() Session("Data") = ds ValidateGrid() End Sub above code is used for binding the grid and the following is the sort command Private Sub CustGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles CustGrid.SortCommand Dim ds1 As DataSet = CType(Session("Data"), DataSet) Dim dv As DataView = ds1.Tables(0).DefaultView dv.Sort = e.SortExpression FillGrid() End Sub Html Code but this event doesn`t fire..Whate can be the problem???
As I already told you, SortExpression is the problem. Please define SortExpression for the BoundColumns to which you want Sort option.
[Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot