tufanocak
01-09-2004, 10:06 AM
My sort sub function works fine on any pages, but not on the next page (for example on 2. or 3. page) ,when i click the sort hyperlink it goes to the first index (first page) without sorting.
i use PagerStyle-Mode="NumericPages"
But the sort hyperlinks works always fine on first index pages.
Any idea ?
Here my codes:
<asp:DataGrid AllowCustomPaging="true" AllowPaging="true"
AllowSorting="True"
AutoGenerateColumns="false"
DatakeyField="stock1A"
CellPadding="2"
CellSpacing="0"
DataSource="<%# DataSet1.DefaultView %>"
id="CartGrid"
PagerStyle-Mode="NumericPages"
PageSize="<%# DataSet1.PageSize %>"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="siralama"
width="95%" OnPageIndexChanged="DataSet1.OnDataGridPageIndexChanged" virtualitemcount="<%# DataSet1.RecordCount %>"
>
and for example:
<asp:BoundColumn DataField="witdh_cm" SortExpression="witdh_cm"
HeaderText="ENƯ(cm)"
ReadOnly="true"
Visible="True"
ItemStyle-HorizontalAlign="Center"/>
and OnSortCommand:
sub siralama(sender As Object, e As DataGridSortCommandEventArgs)
Dim dv As System.Data.DataView = dataset1.DefaultView
dv.Sort = e.SortExpression.ToString()
cartgrid.DataSource = dv
cartgrid.DataBind()
end sub
i use PagerStyle-Mode="NumericPages"
But the sort hyperlinks works always fine on first index pages.
Any idea ?
Here my codes:
<asp:DataGrid AllowCustomPaging="true" AllowPaging="true"
AllowSorting="True"
AutoGenerateColumns="false"
DatakeyField="stock1A"
CellPadding="2"
CellSpacing="0"
DataSource="<%# DataSet1.DefaultView %>"
id="CartGrid"
PagerStyle-Mode="NumericPages"
PageSize="<%# DataSet1.PageSize %>"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="siralama"
width="95%" OnPageIndexChanged="DataSet1.OnDataGridPageIndexChanged" virtualitemcount="<%# DataSet1.RecordCount %>"
>
and for example:
<asp:BoundColumn DataField="witdh_cm" SortExpression="witdh_cm"
HeaderText="ENƯ(cm)"
ReadOnly="true"
Visible="True"
ItemStyle-HorizontalAlign="Center"/>
and OnSortCommand:
sub siralama(sender As Object, e As DataGridSortCommandEventArgs)
Dim dv As System.Data.DataView = dataset1.DefaultView
dv.Sort = e.SortExpression.ToString()
cartgrid.DataSource = dv
cartgrid.DataBind()
end sub