Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auuug sorting grid

Status
Not open for further replies.

thetickisme

Programmer
Oct 19, 2005
12
US
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:pageBind 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:DataGrid
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top