Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple listbox won't display

Status
Not open for further replies.

devRyan

Programmer
Joined
Sep 1, 2006
Messages
104
Location
US
Hi all,

I'm having a problem getting a simple asp:listbox to display. I've got the following code:


Code:
<asp:ListBox ID="lstTest" runat="server" Width="150px" SelectionMode="Multiple">                
                <asp:ListItem>Test1</asp:ListItem>
                <asp:ListItem>Test2</asp:ListItem>
            </asp:ListBox>

I've also tried multiple permutations of attribute settings, and even tried to plug in sample code from the web, with no luck.

I'm using VS2005, and it's provided ASP.NET Development Server for testing, which so far seems to be working just fine.

When the page loads, everything is as should be, except the listbox is just an empty listbox frame, about 5px high, it seems to be taking the width property fine, but the row property makes no change to the way it displays.

The generated HTML is as follows, which appears to be fine:

Code:
<select size="4" name="ctl00$MainContent$lstTest" multiple="multiple" id="ctl00_MainContent_lstTest" style="width:150px;">
    <option value="Test1">Test1</option>
    <option value="Test2">Test2</option>

</select>

Thanks for any help in advance.

Ryan
 
This should work for you.


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BidRecieved()
End If
End Sub

Sub BidRecieved()
Dim myBidRcvd As ArrayList
myBidRcvd = New ArrayList

myBidRcvd.Add("1999")
myBidRcvd.Add("2000")
myBidRcvd.Add("2001")
myBidRcvd.Add("2002")
myBidRcvd.Add("2003")
myBidRcvd.Add("2004")
myBidRcvd.Add("2005")
myBidRcvd.Add("2006")
myBidRcvd.Add("2007")
' myBidRcvd.Insert(0, "--Select year--")
lstbidrcvd.DataSource = myBidRcvd
lstbidrcvd.DataBind()

End Sub
 
No luck going that route either. :(

I just tried my original code, which was ok, in a new website and it worked, so I guess I've got something in my config that has borked this functonality.

I've done very little so far in the lines of changes to the config on this site. I'm still in the stage of mocking it up for my PM. I haven't overridden any classes, or done anything that I can think of that would break this.

Any other ideas?

 
I've tracked down the problem. Something in the css that the client provided is killing select menus.

Thanks for the help.
 
Javascript can do this as well, if it is setting focus to something (such as keeping a popup window in focus)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top