473,670 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList not displaying properly solution

I thought I would share this (semi) annoying issue I had. Basically, the
DropDownList I was trying to bind inside a Repeater with the ItemDataBound
event was not working - instead of a normal listbox, I was getting a row of
string values. The problem was that I left out the closing '>' from the
literal control that was directly in front of the DDL.

Private Sub Repeater1_ItemD ataBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Repe aterItemEventAr gs) Handles
Repeater1.ItemD ataBound
'Bind Name
CType(e.Item.Fi ndControl("litN ame"), Literal).Text = "<p><b>" &
objDS.Tables("T able2").Rows(e. Item.ItemIndex) .Item("personam e") & "</b></p"
<-----

'Bind DropDownList
Dim lstWho As DropDownList = CType(e.Item.Fi ndControl("lstw ho"),
DropDownList)
lstWho.DataSour ce = objDS.Tables("T able1")
lstWho.DataText Field = "Name"
lstWho.DataValu eField = "ID"
lstWho.DataBind ()
End Sub

Hope that can help someone save some time someday!
Nov 17 '05 #1
0 1105

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3477
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or less would display, but those close to 300 pixels/inch or greater would not (MS Access cannot recognize the file format xxx.jpg). The larger, original images were scanned and saved as .bmp (at 300 dpi producing a 15MB file). Then the images were...
18
2440
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a textbox, and in the second row I need to bind data into a dropdownlist...It all depends on the data I select from the database. I cannot use TemplateColumn because it has to be the same type of control for one column.
6
5398
by: Scott Lee | last post by:
I am displaying an ASP.Net generated form in a popup opened with window.showModalDialog. The form contains DropDownList controls. The first ddl is populated via databinding to a datatable, has its AutoPostBack set to true and has its SelectedIndexChanged event being handled in codebehind. The event fires as it should populating two more ddls. The problem is, the two ddls appear empty. I have used a javascript alert to look at the...
3
4364
by: Tim::.. | last post by:
Can someone tell me how I get the correct selected office in my drop down list when I enter edit mode. At the moment it just defaults to the office at the top of the drop down list rather than picking the office that has actually been selected previously! I hope this is clear... Here is my code... Thanks
4
1973
by: TheHach | last post by:
Hi. (For information, i'm working in VB.NET) I have a datagrid on my page. On its creation, I add a dropdownlist in each cell, with a different ID each time. This works fine. But now, I can't access on the selected values of those dynamic dropdownlists.
2
7905
by: Dabbler | last post by:
In my Registrant FormView I have a DropDownList which loads data from a secondary SqlDataSource "sdsOfficeParks". I need the user to select an office park but save the selected value in the FormView's ObjectDataSource "odsRegistrant" . The following solution can't work because I need the ddl selected value bound to my odsRegistrant but both tables have the same column name for primary key. <asp:DropDownList ID="ddlOfficePark"...
1
1155
by: rajiv Joshi | last post by:
Hi all I m displaying locations from database in the dropdownlist box using C# .Its displaying all locations properly but when i select loacation from dropdown it is always displaying first item say Bhopal as selected and but i want to select any item it is not getting selected. Can anybody pls tell me what might be the reason?
3
10572
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the second of which resides within an UpdatePanel control which responds to a change in the first DropDownList. I also have a hidden button nested inside the UpdatePanel to force a postback via JS. The user uses these two DropDownList controls to create...
2
1320
by: Adam Mather | last post by:
What was your solution to this problem in the end Jacque?. I am attempting to re-write an ASP / VB Script application in C# to be made available as a series of web parts to be deployed on WSS 3.0. I have a form which has three dropdownlists. similar to your senario i require the first dropdownlist to populate the second and the second dropdownlist to populate the third. i have tackled this problem in many different ways and am still...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8660
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7415
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4209
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4390
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1792
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.