Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 June 24th, 2004, 09:59 AM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default List Box

Hello, i am trying to insert items in a ListBox (using VB) like this:

<script language="VB" runat="server">
  Sub Page_Load(src as Object, e as EventArgs)
    MyListBox.Items.Add(new ListItem("Template1","template1"))
    MyListBox.Items.Add(new ListItem("Template2","template2"))
    MyListBox.Items.Add(new ListItem("Template3","template3"))
  End Sub
</script>

And the ListBox:

<asp:listbox id="MyListBox" style="Z-INDEX: 115; LEFT: 664px;
             POSITION: absolute; TOP: 224px"
             runat="server" Height="168px" Width="160px">
</asp:listbox>


Well..
The problem is that it designs the ListBox, but it doesn't insert the items.
Any reason for that happen??
Am i doing something wrong?


Thanx a lot,

Nuno Oliveira.


PS:
  I have allrady tryied to do it like this:

<script language="VB" runat="server">
  Sub Page_Load(src as Object, e as EventArgs)
    Dim arrList as new ArrayList()
    arrList.Add("Template 1")
    arrList.Add("Template 2")
    arrList.Add("Template 3")
    MyListBox.DataSource = arrList
    MyListBox.DataBind()
  End Sub
</script>



 
Old June 27th, 2004, 10:01 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

There doesn't appear to be anything wrong with you code from what I can see. Can you do a test in Page_Load to confirm that its being executed? Try putting a "Response.Write(...)" in there to see if that method is actually running. If that doesn't help, then post some more of the page. There may be something else on the page that's causing the problem.
 
Old June 28th, 2004, 05:31 AM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello.

Well.
I have resolved the problem.
I am using the editor VisualStudio.net, and it generates a few files. I have the file Template.aspx and it generates the file Template.aspx.vb.
I have put the Sub Page_Load in this file, and it works fine, now.


thanx anyway,

Nuno.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 03:04 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





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