On 11/03/2010 17:11, Ken MacDonald wrote:
Hi, I have an app with a popup containing a listbox. I want to dynamically add a few items to the listbox and found code in a number of places which does something like:

            listbox.Items.Add(ListItem("Special", 11))
            listbox.Items.Add(ListItem("Regular", 19))

However, I can't find the proper import so that it finds ListItem. On MSDN it shows as being in

from System.Web.UI.WebControls import ListItem

That's for ASP - is that what you are using?

but I get "can't import UI"

You will need to add a reference to its containing assembly before you can import it.


So, anyone know how to do this?

Also, I'm concerned that next time (if I ever get it working first time) I come to this popup, it will contain the items I had added previously; how does one go about clearing the whole listbox?
listbox.Items.Clear()

HTH,

Michael


Thanks,
Ken


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to