J
Jeff User
Greeting
I built asp.net (V1.1) page.
I want to use this button to reset SelectedIndex=0 on several drop
down lists. However, I do not want to post back to server. The point
is to avoid the round trip.
It had an asp:button which would post back to the server when clicked
but changed it to an input button to avoid the postback. (If that is
not needed,let me know)
So, I now have
<input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script
function Clear_ddls()
{
want to set ddlLastName.selectedIndex = 0;
}
I know the script runs because I put an alert message in there.
I do not know how to reference the drop down lists contained on my
asp.net page from in the script.
I tried different forms of document.get..., or Form1.ddlLastName,
etc.. but can not get it to work.
My form contains
<ASP:dropdownlist id="ddlLastName"
runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for
me. I just want to be able to reset it on client side with script.
Can I do this?
thanks
Jeff
I built asp.net (V1.1) page.
I want to use this button to reset SelectedIndex=0 on several drop
down lists. However, I do not want to post back to server. The point
is to avoid the round trip.
It had an asp:button which would post back to the server when clicked
but changed it to an input button to avoid the postback. (If that is
not needed,let me know)
So, I now have
<input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script
function Clear_ddls()
{
want to set ddlLastName.selectedIndex = 0;
}
I know the script runs because I put an alert message in there.
I do not know how to reference the drop down lists contained on my
asp.net page from in the script.
I tried different forms of document.get..., or Form1.ddlLastName,
etc.. but can not get it to work.
My form contains
<ASP:dropdownlist id="ddlLastName"
runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for
me. I just want to be able to reset it on client side with script.
Can I do this?
thanks
Jeff