Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 29th, 2003, 06:20 AM
Registered User
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sorting a Datagrid - Help Please!

This is my code - Allow Sorting is set to True, but this still doesn't work - can anyone tell me why please?



Public Class WebForm3
    Inherits System.Web.UI.Page
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
    Protected WithEvents SpeciesLP11 As SppHabLPsWebClient.pauline_warman.SpeciesLP1

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.SpeciesLP11 = New SppHabLPsWebClient.pauline_warman.SpeciesLP1()
        CType(Me.SpeciesLP11, System.ComponentModel.ISupportInitialize).BeginIni t()
        Me.SpeciesLP11.DataSetName = "SpeciesLP1"
        Me.SpeciesLP11.Locale = New System.Globalization.CultureInfo("en-GB")
        Me.SpeciesLP11.Namespace = "http://www.tempuri.org/SpeciesLP1.xsd"
        CType(Me.SpeciesLP11, System.ComponentModel.ISupportInitialize).EndInit( )

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ws As New SppHabLPsWebClient.pauline_warman.SppHabLPsService ()
        ws.Credentials = System.Net.CredentialCache.DefaultCredentials
        DataGrid1.DataSource = SpeciesLP11
    End Sub

    Sub DataGrid1_SortCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridSortCommandEvent Args) _
Handles DataGrid1.SortCommand

        Dim oDataSet = SpeciesLP11
        Dim DataView1 As DataView

        DataView1 = New DataView(oDataSet.Tables(0))
        DataView1.Sort = e.SortExpression
        DataGrid1.DataSource = DataView1

    End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid sorting Amorous ASP.NET 1.x and 2.0 Application Design 1 September 30th, 2005 11:44 PM
Sorting a datagrid trekmp ADO.NET 7 December 18th, 2004 06:56 AM
Datagrid sorting by non alphabetical sorting? LLAndy VS.NET 2002/2003 1 July 15th, 2004 01:20 AM
DataGrid Sorting spm74 ASP.NET 1.0 and 1.1 Basics 3 May 26th, 2004 08:52 AM
DataGrid Sorting Example SPRIBob BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 10 July 30th, 2003 09:48 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.