HtmlSelect Problem

Results 1 to 2 of 2

Thread: HtmlSelect Problem

  1. #1
    Join Date
    Dec 1969

    Default HtmlSelect Problem

    I&#039;m trying to use a HtmlSelect control on a page, because I&#039;m doing a lot of client side scription. While the user interacts with the page, items get added to the select list. But when the form gets posted back to the server, they aren&#039;t there. Here is some code:<BR><BR>Here is the tag declaring the list in the HTML:<BR>&#060;select id="lstIntervals" onchange="clearIntervalIfEditing()" size="5" name="lstIntervals" runat="server"&#062;&#060;/select&#062;<BR><BR>Here is the button that submits the form:<BR>&#060;input id="btnUpdateWorkout" onclick="submitForm()" type="button" value="Finished" name="btnUpdateWorkout" runat="server"&#062;<BR><BR>Here is the submitForm() function:<BR>function submitForm() {<BR>&nbsp;&nbsp;alert( document.edit.lstIntervals.options.length );<BR>&nbsp;&nbsp;document.edit.submit();<BR>}<BR> <BR>(That alert throws up the number of elements in the list box when it is submitted.)<BR><BR>Here is the code checking the number of elements in the list on the server side of the code (after being posted back):<BR>Response.Write( lstIntervals.Items.Count );<BR><BR>(This writes out 0 to the page.)<BR><BR>I&#039;m hoping that I&#039;m just missing an attribute here or there, or something simple. It would really help if someone could spot something out of there. Thanks for looking...

  2. #2
    Join Date
    Dec 1969

    Default Interesting...

    It would appear you have hit on a limitation of RUNAT=SERVER controls.<BR><BR>Since there is nothing telling the server that the list on the client was changed, the server simply maintains the original list.<BR><BR>I think you&#039;ll have to write your own control (or extend the standard one?) to make this work. Or somehow post info back to the server that will cause it to update its "memory" of the list of &#060;OPTION&#062;s.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts