I dont know how to implement this,
my code for the datagrid is,
----
<asp
ataGrid runat="server" id="myDataGrid" autogeneratecolumns="false"
Border="0" ShowHeader="True"
AllowPaging="True" HorizontalAlign="center" PageSize="50"
PagerStyle-Mode="NumericPages" PagerStyle-PageButtonCount="100"
PagerStyle-HorizontalAlign="center" DataKeyField="U_ID"
AllowSorting="True" OnSortCommand="myDataGridMain_Sorting"
OnItemDataBound="myDataGrid_ItemDataBound" width="100%"
OnPageIndexChanged="myDataGrid_PageIndexChanged">
<columns>
<asp:BoundColumn DataField="A_LEVELNAAM" SortExpression="A_LEVELNAAM"
HeaderText="<strong>Level</strong>" />
<asp:BoundColumn DataField="U_Posts" SortExpression="U_Posts"
HeaderText="<strong>Posts</strong>" />
<asp:BoundColumn DataField="U_Registered_On"
SortExpression="U_Registered_On" HeaderText="<strong>Join Date</strong>"
DataFormatString="{0:dd-M-yyyy}" />
<asp:BoundColumn DataField="U_Last_Logged_In"
SortExpression="U_Last_Logged_In" HeaderText="<strong>Last Active</strong>"
DataFormatString="{0:dd-M-yyyy}" />
</columns>
</asp
ataGrid>
----
The field i want to sort this way is the U_Posts. I use that field for
whenever a person posts a item on the website, it does +1. When i look at
the users information i just want to see what user made the most posts on
the website etc.
Do you have a way how i can implement your idea into this?
my code behind for the databind()
----------------------
Sub BindData(ByVal sortExpr As String)
Dim ds As New DataSet
Dim dsc As SqlDataAdapter
Dim strSQL As String
Dim strCon As String
'strSQL = "SELECT * FROM tbl_Users ORDER BY " & sortExpr & ""
strSQL = "SELECT tbl_Users.*, tbl_Level.A_LEVELID,
tbl_Level.A_LEVELNAAM FROM tbl_Users INNER JOIN tbl_Level ON
tbl_Users.U_ToegangsID = tbl_Level.A_LEVELID ORDER BY " & sortExpr & ""
strCon = ConfigurationSettings.AppSettings("DigifanDatabaseCon")
dsc = New SqlDataAdapter(strSQL, strCon)
dsc.Fill(ds, "tbl_Users")
myDataGrid.DataSource = ds.Tables("tbl_Users").DefaultView
myDataGrid.DataBind()
End Sub
--------------------
Thx in advance