I hope someone can help me. When a user selects a new item from a
drop down list on an ASP.NET form, I'd like a javascript function to execute.
How can I do this?
I'm running the following configuration:
VS2005 - using VB.NET
ASP.NET 2.0
IIS 6.0
Windows XP, SP2
I have the following .aspx code behind my ASP.NET page. When a user presses button "btnClearTaskRe sults" the javascript function "ClearNodes ()" DOES execute properly:
<asp:Button ID="btnClearTas kResults" runat="server" OnClientClick=" javascript:clea rNodes()" Text="Clear Task Results" />
<script language="javas cript" type="text/javascript" src="javascript/WebMapApp.js"></script>
<script language="javas cript" type="text/javascript">
function clearNodes() {$find('TaskRes ults1').clearAl lNodes();}
</script>
However, I cannot figure out how to get similar functionality for a drop down list box. I tried adding a OnSelectedIndex Changed to my drop down .aspx code, as follows:
<asp:DropDownLi st ID="dropMapServ ice" runat="server" OnSelectedIndex Changed="javasc ript:clearNodes ()" AutoPostBack="t rue">
Unfortunately, I get the following 2 compile errors:
1. 'javascript' is not a member of 'ASP.mapterrain _aspx'.
2. Name 'clearNodes' is not declared
I'm new to javascript & I've mainly been programming in VB.NET, so I would greatly appreciate any help you could give me.
Thanks,
Julie
drop down list on an ASP.NET form, I'd like a javascript function to execute.
How can I do this?
I'm running the following configuration:
VS2005 - using VB.NET
ASP.NET 2.0
IIS 6.0
Windows XP, SP2
I have the following .aspx code behind my ASP.NET page. When a user presses button "btnClearTaskRe sults" the javascript function "ClearNodes ()" DOES execute properly:
<asp:Button ID="btnClearTas kResults" runat="server" OnClientClick=" javascript:clea rNodes()" Text="Clear Task Results" />
<script language="javas cript" type="text/javascript" src="javascript/WebMapApp.js"></script>
<script language="javas cript" type="text/javascript">
function clearNodes() {$find('TaskRes ults1').clearAl lNodes();}
</script>
However, I cannot figure out how to get similar functionality for a drop down list box. I tried adding a OnSelectedIndex Changed to my drop down .aspx code, as follows:
<asp:DropDownLi st ID="dropMapServ ice" runat="server" OnSelectedIndex Changed="javasc ript:clearNodes ()" AutoPostBack="t rue">
Unfortunately, I get the following 2 compile errors:
1. 'javascript' is not a member of 'ASP.mapterrain _aspx'.
2. Name 'clearNodes' is not declared
I'm new to javascript & I've mainly been programming in VB.NET, so I would greatly appreciate any help you could give me.
Thanks,
Julie
Comment