Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 13th, 2006, 10:01 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataView will not DataBind with a GridView?!

I am trying to get a list of Dates and times to show up dynamically in a GridView. I couldn't figure out how to format it properly using an AccessDataSource so instead I decided to code it myself.

I've gotten it to put data from the access database into the DataTable, and I've then transferred it into a DataView. However, whenever I try to DataBind it, it doesn't seem to do anything. I've spent several hours trying to figure it out, and tracking it line by line and have come up with nothing. Am I approaching it the wrong way?

Code:
        Dim Roster As DataTable = New DataTable()

        Roster.Columns.Add(New DataColumn("Day", GetType(String)))
        Roster.Columns.Add(New DataColumn("Start", GetType(String)))
        Roster.Columns.Add(New DataColumn("Finish", GetType(String)))

        Dim getData As New OleDbCommand("SELECT Roster.Date, Roster.Start, Roster.Finish FROM UserDetail INNER JOIN Roster ON UserDetail.UserID = Roster.UserID WHERE (UserDetail.UserName)='Jason';", myConnection)
        Dim rosData As OleDbDataReader

        myConnection.Open()
        rosData = getData.ExecuteReader()

        Do While rosData.Read()
            Dim dRow As DataRow = Roster.NewRow()
            dRow.Item(0) = DateTime.Parse(rosData.Item(0)).DayOfWeek.ToString()
            dRow.Item(1) = DateTime.Parse(rosData.Item(1)).TimeOfDay.ToString()
            dRow.Item(2) = DateTime.Parse(rosData.Item(2)).TimeOfDay.ToString()
            Roster.Rows.Add(dRow)
        Loop

        myConnection.Close()
        Dim RosterView As DataView = New DataView(Roster)

        If Not RosterView Is Nothing Then
            RosterGrid.DataSource = RosterView
            RosterGrid.DataBind()
            RosterGrid.Visible = True
        End If


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databind DarkForce ASP.NET 2.0 Basics 5 January 25th, 2011 12:04 PM
About the Databind() kuuy BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 November 15th, 2006 12:56 PM
Databind in TextBox kapi.goel C# 1 April 26th, 2006 05:51 AM
Gridview DataBind to DataTable not showing changes wirerider ASP.NET 2.0 Basics 1 March 4th, 2006 08:59 PM
Can't get RadioButtonlist with databind nayalksrs123 .NET Web Services 0 January 15th, 2005 06:29 AM



All times are GMT -4. The time now is 05:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.