Wrox Programmer Forums
|
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 16th, 2008, 03:01 PM
Authorized User
 
Join Date: Mar 2005
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry..
The repeater loads with the correct amount of records. Each record needs to have a dropdown associated with it which I am using the separate stored proc to populate.
The dropdowns are empty when the page loads. Thats the only issue.

 
Old April 16th, 2008, 03:10 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

So many more questions to be asked and answered....

Did you debug the code?
What happens when you debug it?
Is Repeater1_ItemCreated being triggered?
Does e.Item.FindControl("ddlOrdinal") result in a valid control reference?
Does objDDL have a valid selected value?
Is your data access code firing correctly?
Is the right data passed to the database?
Is the right data returned from the database?

And so on and so forth....

In other words: impossible for me to answer without relevant information.

My advice: set a breakpoint in Repeater1_ItemCreated (press F9), debug the application (press F5) and see how it behaves. Step through the code line by line and see what happens....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old April 16th, 2008, 03:58 PM
Authorized User
 
Join Date: Mar 2005
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did debug through the code. WHen I get to objDDL.DataSource = dtr I placed the mouse over the dtr and it showed hasrows = true, fieldcount=2, recordsaffected =-1.
Is there anyway I can display the result of the datareader before I set it to the dropdown to make sure data is returned?

I am not getting any errors, the dropdowns are all just completely empty.


 
Old April 17th, 2008, 08:39 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If HasRows is true, it's safe to say the reader has data. So, the problem must be elsewhere.

Is the code triggered for the right ItemTypes? Is the code called too often so you override the exiting items with an empty list? Is objDDL holding a reference to the correct DropDownList? What happens when you manually add an item to the DropDownList directly after the call to DataBind? Does that item end up in the list?

Again, since I don't have the whole code, can't see what you've posted because the page is way too wide to read and can't try out your code as I don't have your database, I can only ask questions, not recommend a true fix.


Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 29th, 2008, 12:10 PM
Registered User
 
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do something similar. Here is what I do.

In my form_load event, I create a DataSet (Dim ds as DataSet) and fill that with data from my webservice.

In the RepeaterId_ItemDataBound event I bind my dropdownlist (ddlVendor) to my DataSet, and set the DataValueField, DataTextField:

Dim vendorList As DropDownList = CType(e.Item.FindControl("ddlVendor"), DropDownList)
        vendorList.DataTextField = "vsNoName"
        vendorList.DataValueField = "vsmSupplierID"
        vendorList.DataSource = ds
        vendorList.DataBind()






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown in repeater (Moved From C# Forum) rodmcleay ASP.NET 1.0 and 1.1 Basics 14 June 20th, 2008 07:11 AM
Dropdown in Repeater kylemccullough ASP.NET 1.0 and 1.1 Basics 7 June 17th, 2004 01:04 PM
Repeater collie VB.NET 2002/2003 Basics 1 December 2nd, 2003 05:30 PM





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