[Mono-list] How to maintain values in a HtmlSelect when modifying the content with javascript ?
Tiago Lima
tiago.lima@vianw.pt
Fri, 12 Dec 2003 16:45:03 +0000
Ok, I used the HtmlInputHidden and it works fine now!
Just like the VIEWSTATE hidden field :)
Thanks! I thought it would be more difficult, but it was very easy to do!
Thanks,
Tiago Lima
On Friday 12 December 2003 16:25, Gonzalo Paniagua Javier wrote:
> El vie, 12-12-2003 a las 13:59, Tiago Lima escribi=F3:
> > Hi,
> >
> > Ok, I tried with the DropDownList but It appears that the elements I add
> > in javascript are not "added" when I post the page with the result.
> > Perhaps meaning that the DropDownList doesnt add the elements on
> > postback... ?
> >
> > I have to note that I add DropDownList's on PageLoad...
> > So, I would like to know if I add a new one on PageLoad, just like I do
> > with for example the TextBoxes, It can keep the state comming from the
> > posted page... (the number of controls and the controls are the same in
> > the posted page and the created page on PageLoad...) I dont know if you
> > understand what I mean...
>
> You cannot add items using javascript on the client side and expect the
> server to know about that. If you want to do so, you need to roll your
> our mechanism. I would suggest adding a hidden field with the values you
> added (may be also a number) and re-create the control in Page_Load
> using those hidden fields. May be you also want to derive from any of
> the existing controls to implement this feature.
>
> -Gonzalo
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list