p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 23rd, 2003, 05:30 PM
Registered User
Points: 4, Level: 1
Points: 4, Level: 1 Points: 4, Level: 1 Points: 4, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Bath, , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default data grid in chapter 17, page 708

hi i can get the datagrid to display all the data and i can change the default property of what i want to sort by but when i acctually click the columns in the web page it does nothing!!

ive checked the code and the only thing i guess there could be a problem would be the datagrid itself, but all seems ok (it says the bit about javascript in the status etc!!)

HELP!

Grant

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 16th, 2004, 01:48 AM
Registered User
Points: 23, Level: 1
Points: 23, Level: 1 Points: 23, Level: 1 Points: 23, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: San Diego, CA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Grant,
I'm just a newbe but I mannaged to get this one to work.

I don't know what you did wrong but I have pasted my code below, being that their is no sample code for this one in the code download.
I sure hope this helps!
I am having trouble with the next exercise DataGrid Updates, check out my post.


Imports System.Data
Imports System.Data.SqlClient

Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents grdAuthors As System.Web.UI.WebControls.DataGrid

    ' Declare a connection object that is global in scope...
    Dim objConnection As SqlConnection

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    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.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here

        ' Initialize the Connection object...
        objConnection = New SqlConnection("Server=New\NetSdk;database=pubs;Int egrated Security=sspi")

        ' Only bind the data the first time the page is built...
        ' Subsequent post backs will be to sort the data in the grid...
        If Not (IsPostBack) Then
            BindGrid("Last Name")

        End If

    End Sub

    Public Sub BindGrid(ByVal strSortField As String)
        ' Declare objects...
        Dim objDataSet As DataSet
        Dim objDataAdapter As SqlDataAdapter

        'Set the Sql String...
        objDataAdapter = New SqlDataAdapter( _
        "Select au_lname AS 'Last Name', au_fname AS 'First Name', " & _
        "Title AS 'Book Title', price AS 'Retail Price' " & _
        "From authors " & _
        "JOIN titleauthor ON authors.au_id = titleauthor.au_id " & _
        "JOIN titles ON titleauthor.title_id = titles.title_id " & _
        "ORDER BY au_lname, au_fname", objConnection)

        ' Initialize the DataSet object and fill it...
        objDataSet = New DataSet()
        objDataAdapter.Fill(objDataSet, "Authors")

        ' Declare a DataView object, populate it,
        ' and sort the data in it...
        Dim objDataView As DataView = _
        objDataSet.Tables("Authors").DefaultView
        objDataView.Sort = strSortField

        ' Bind the DataView object to the DataGrid control...
        grdAuthors.DataSource = objDataView
        grdAuthors.DataBind()

        ' Clean up...
    End Sub

    Private Sub grdAuthors_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles grdAuthors.SortCommand
        ' Bind the DataGrid using the sort column requested
        BindGrid(e.SortExpression)
    End Sub

    Private Sub grdAuthors_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grdAuthors.SelectedIndexChanged

    End Sub
End Class
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 17 - Wrox United Login Page Kevin2105 BOOK: Beginning ASP.NET 1.1 0 August 10th, 2006 07:22 AM
Chapter 17 - Report Data Source Granted BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 February 21st, 2006 10:53 AM
Data grid sorting on page 707 matejx BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 6 December 2nd, 2005 05:43 AM
problem in auto page navigation of data grid in AS kranthipriya ASP.NET 1.x and 2.0 Application Design 1 February 23rd, 2005 08:01 PM
DataGrid Updates BLANK PAGE (Chapter 17) happyhorseygal BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 April 8th, 2004 02:11 PM



All times are GMT -4. The time now is 12:23 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc