[Mono-devel-list] RE: [Mono-list] How to maintain values in a HtmlSelect when modifying the content with javascript ?

John BouAntoun jbouantoun at rogen.com.au
Thu Dec 11 18:06:45 EST 2003


Tiago,

If you want to use the equivalent of a Html Select element, that is able to have it's
values handle in C# on the server (i.e. on page load and after a postback etc) then why not simply use
the System.Web.UI.WebControls.DropdownList item?

You can bind the dropdown list option elements to records in a dataview or dataset and
you can also get / set the selected index.

I'm pretty sure that's what you are looking for.

JBA



-----Original Message-----
From: Tiago Lima [mailto:tiago.lima at vianw.pt]
Sent: Friday, 12 December 2003 10:00 AM
To: mono-devel mailing list; mono-list mailing list
Subject: [Mono-list] How to maintain values in a HtmlSelect when
modifying the content with javascript ?


Hi,

I've a question regarding whether an HtmlSelect maintains the "options" inside 
it when these options get modified in javascript. I dont know how 
Microsoft .NET handles this...

I have two HtmlSelects, one of them starts empty and the other one have all 
the elements... The user moves around the elements from one to another and 
then posts the result... I want to know the elements in the first 
HtmlSelect... How do I do this?

If I select one of the elements in the first HtmlSelect then I get an error:

System.IndexOutOfRangeException: Array index is out of range
in [0x00074] (at /home/duncan/Mono/mcs/class/System.Web/
System.Web.UI.HtmlControls/HtmlSelect.cs:209) 
System.Web.UI.HtmlControls.HtmlSelect:System.Web.UI.IPostBackDataHandler.LoadPostData 
(string,System.Collections.Specialized.NameValueCollection)
i
...

this is because the HtmlSelect has no elements in the beggining !

Is the System.Web.UI.WebControls.ListBox controls doing this?

Thanks in advance,
	Tiago Lima

_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-devel-list mailing list