Updating of the asp.net dropdown control using javascript -
in asp.net default.aspx, have dropdown list command , next javascript code
<asp:dropdownlist id="ddlgenres" runat="server" appenddatabounditems="true" autopostback="true" datasourceid="entitydatasource2" datatextfield="cityid" datavaluefield="cityid" onselectedindexchanged="ddlgenres_selectedindexchanged" clientidmode="static" > <script type="text/javascript"> var ddlclientid = '<%=ddlgenres.clientid%>'; //document.getelementbyid(ddlgenres) function setddlval(nindx) { //$("#ddlgenres") var ddllistselect = document.getelementbyid(ddlclientid); ddllist.selectedindex = nindx; } </script>
====================================================================
in external javascript file, calling function setddlval. debugged code , ddllist selectedindex changed within script.
=====================================================================
the issue facing is, when selectedindex value changed in javascript, ddlgenres_selectedindexchanged code not beingness triggered. please allow me know if missing anything. nate
in javascript property of <select>
input selectedindex
not selectedindex
.
change function this:
function setddlval(nindx) { var ddllistselect = document.getelementbyid('<%=ddlgenres.clientid%>'); ddllistselect.selectedindex = nindx; }
javascript asp.net
No comments:
Post a Comment