coolvaas
September 9th, 2004, 03:11 PM
I have the following problem.
My asp.net page has one html list box control and I made that as "RUN AS SERVER" so that I could access it in client side script as well as server side script. And also I have a 2 buttons in my form one is an html button and the other a server side button. When I click on the html button using client side script I am adding some data to the list box. And when user clicks on the server side button I want to acess the contents of the list box. But the thing is the moment I click on the server side button it clears the contents of the list box (even though I made it run as server). Then I tried to do the same using an HTML text box and it works fine. It's contents never get's cleared. But the list box always clears it's contents. Could any one tell me why is this happening? How can I access the contents of the html list box from server side or how can I stop clearing of the list box contents.
Here is my code
<script language="vbscript">
Sub LoadListBoxData()
dim oOption
dim i
for i=1 to 10
set oOption = document.createElement("OPTION")
document.Form1.lstTest.options.add(oOption)
oOption.innerText = now() & i
oOption.value =i
next
end sub
</script>
'''Here is my html code which calls the LoadListBoxData procedure
<INPUT style="Z-INDEX: 103; LEFT: 408px; POSITION: absolute; TOP: 104px" onclick="LoadListBoxData()" type="button" value="Button">
''Here is web server control button
<asp:button id="Button1" style="Z-INDEX: 104; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server" Text="Submit"></asp:button>
Is there a way to save data in an HTML list box made run as server between postbacks
Any help is greatly appriciated
Thanks
My asp.net page has one html list box control and I made that as "RUN AS SERVER" so that I could access it in client side script as well as server side script. And also I have a 2 buttons in my form one is an html button and the other a server side button. When I click on the html button using client side script I am adding some data to the list box. And when user clicks on the server side button I want to acess the contents of the list box. But the thing is the moment I click on the server side button it clears the contents of the list box (even though I made it run as server). Then I tried to do the same using an HTML text box and it works fine. It's contents never get's cleared. But the list box always clears it's contents. Could any one tell me why is this happening? How can I access the contents of the html list box from server side or how can I stop clearing of the list box contents.
Here is my code
<script language="vbscript">
Sub LoadListBoxData()
dim oOption
dim i
for i=1 to 10
set oOption = document.createElement("OPTION")
document.Form1.lstTest.options.add(oOption)
oOption.innerText = now() & i
oOption.value =i
next
end sub
</script>
'''Here is my html code which calls the LoadListBoxData procedure
<INPUT style="Z-INDEX: 103; LEFT: 408px; POSITION: absolute; TOP: 104px" onclick="LoadListBoxData()" type="button" value="Button">
''Here is web server control button
<asp:button id="Button1" style="Z-INDEX: 104; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server" Text="Submit"></asp:button>
Is there a way to save data in an HTML list box made run as server between postbacks
Any help is greatly appriciated
Thanks