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

John BouAntoun jbouantoun@rogen.com.au
Fri, 12 Dec 2003 10:06:45 +1100


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@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=20
it when these options get modified in javascript. I dont know how=20
Microsoft .NET handles this...

I have two HtmlSelects, one of them starts empty and the other one have =
all=20
the elements... The user moves around the elements from one to another =
and=20
then posts the result... I want to know the elements in the first=20
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)=20
System.Web.UI.HtmlControls.HtmlSelect:System.Web.UI.IPostBackDataHandler.=
LoadPostData=20
(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@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list