thetickisme
Programmer
My sort works but only on the current row of data in the grid. If I go to the next page it's off. And it does not want to desc asc either.
why?
code
<MM
ageBind runat="server" PostBackBind="true" />
<script runat="server">
Protected Sub Sort_Grid(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
Dim dv As System.Data.DataView = DataSet1.DefaultView
If dv.Sort=e.SortExpression + " DESC"
Else
dv.Sort=e.SortExpression + " ASC"
END IF
DataGrid1.DataSource=dv
DataGrid1.DataBind()
End Sub
<asp
ataGrid
AllowCustomPaging="true"
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
DataSource="<%# DataSet1.DefaultView %>" ID="DataGrid1"
PagerStyle-HorizontalAlign="Center"
PagerStyle-Mode="NextPrev"
PagerStyle-NextPageText="Next"
PagerStyle-Position="TopAndBottom"
PagerStyle-PrevPageText="Previous"
PageSize="<%# DataSet1.PageSize %>"
runat="server"
ShowFooter="true"
ShowHeader="true" OnSortCommand="Sort_Grid"
OnPageIndexChanged="DataSet1.OnDataGridPageIndexChanged"
virtualitemcount="<%# DataSet1.RecordCount %>">
thanks
why?
code
<MM
<script runat="server">
Protected Sub Sort_Grid(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
Dim dv As System.Data.DataView = DataSet1.DefaultView
If dv.Sort=e.SortExpression + " DESC"
Else
dv.Sort=e.SortExpression + " ASC"
END IF
DataGrid1.DataSource=dv
DataGrid1.DataBind()
End Sub
<asp
AllowCustomPaging="true"
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
DataSource="<%# DataSet1.DefaultView %>" ID="DataGrid1"
PagerStyle-HorizontalAlign="Center"
PagerStyle-Mode="NextPrev"
PagerStyle-NextPageText="Next"
PagerStyle-Position="TopAndBottom"
PagerStyle-PrevPageText="Previous"
PageSize="<%# DataSet1.PageSize %>"
runat="server"
ShowFooter="true"
ShowHeader="true" OnSortCommand="Sort_Grid"
OnPageIndexChanged="DataSet1.OnDataGridPageIndexChanged"
virtualitemcount="<%# DataSet1.RecordCount %>">
thanks