wbb Posted January 19, 2004 Posted January 19, 2004 i cannt do sorting in grip...any kind souls got the code for it ??? Quote
Moderators Robby Posted January 19, 2004 Moderators Posted January 19, 2004 Post what you have thus far so we can see what methods you are currently using. Quote Visit...Bassic Software
wbb Posted January 20, 2004 Author Posted January 20, 2004 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page MyConnection = New Odbc.OdbcConnection("STMT=;OPTION=3;DSN=mysql;UID=;DESC=MySQL ODBC 3.51 Driver DSN;DATABASE=test;SERVER=localhost;PORT=3306") 'BindGrid() If Not (IsPostBack) Then BindGrid("id") End If End Sub Sub DataGrid1_Sort(ByVal Sender As Object, ByVal E As DataGridSortCommandEventArgs) BindGrid(E.SortExpression) End Sub Sub BindGrid(ByVal SortField As String) Dim DS As DataSet Dim MyCommand As Odbc.OdbcDataAdapter MyCommand = New Odbc.OdbcDataAdapter("select * from item", MyConnection) DS = New DataSet MyCommand.Fill(DS, "item") Dim Source As DataView = DS.Tables("item").DefaultView Source.Sort = SortField DataGrid1.DataSource = Source DataGrid1.DataBind() End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.