Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
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 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 April 21st, 2007, 02:47 PM
Authorized User
Join Date: Feb 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Challenge Filling listbox from codebehind

I have a listbox that I am trying to fill from a code behind page with the following code.
       If MyReader.Read() Then
            lsbRASPPED.DataSource = MyReader
This works, but the listbox does not show the first returned row of my query.

All works well if I use a datasource located on the .aspx page.

Any idea why my first row of data is not showing up in the listbox?

Old April 23rd, 2007, 07:07 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there...
well.. it could be that when you do read you are throwing away the first record??

avoid using the read and past directly the reader to the list to see what happens...



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
================================================== =========
Old April 28th, 2007, 02:25 PM
Authorized User
Join Date: Feb 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the suggestion, that did the trick.

The following code works:


        lsbRASPPED.DataSource = InitialCommand.ExecuteReader

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
A little challenge... chacquard Access VBA 7 February 2nd, 2007 11:38 AM
Help for newbie filling listbox JMorrell VB.NET 1 March 19th, 2005 04:36 PM
A Challenge... AForgue XSLT 3 November 5th, 2003 04:14 PM
Challenge.... developerz BOOK: ASP.NET Website Programming Problem-Design-Solution 2 September 29th, 2003 04:49 PM

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