Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DropDownList not displaying properly solution

Reply
Thread Tools

DropDownList not displaying properly solution

 
 
Jim French
Guest
Posts: n/a
 
      07-21-2003
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_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemDataBound
'Bind Name
CType(e.Item.FindControl("litName"), Literal).Text = "<p><b>" &
objDS.Tables("Table2").Rows(e.Item.ItemIndex).Item ("personame") & "</b></p"
<-----

'Bind DropDownList
Dim lstWho As DropDownList = CType(e.Item.FindControl("lstwho"),
DropDownList)
lstWho.DataSource = objDS.Tables("Table1")
lstWho.DataTextField = "Name"
lstWho.DataValueField = "ID"
lstWho.DataBind()
End Sub

Hope that can help someone save some time someday!


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysterious problem with pages not displaying properly. New Conservative HTML 16 03-09-2005 02:50 AM
text not displaying properly David Java 0 08-02-2004 03:11 PM
Labels not displaying properly...help!? B J H Java 19 12-10-2003 06:53 AM
Ie Web Controls Problem (Not displaying Properly On Production Server) =?Utf-8?B?UmVkZHk=?= ASP .Net 2 10-30-2003 04:41 AM
Page Not displaying Properly? ={ Advocated }= HTML 44 09-14-2003 09:55 AM



Advertisments