c# - Javascript values not updating after dropdown selection -


i have value i'm passing server side c# code client side javascript need update based on dropdown selection. value gets changed required in c# logic value change never picked client.

here c# code setting value

protected void ddlcurrency_onselectedindexchanged(object sender, eventargs e) {     dropdownlist ddlcurrencytype = (dropdownlist)upfilter.findcontrol("ddlcurrency");      currencyid = int.parse(ddlcurrencytype.selecteditem.value); }  private void setcurrencysymbol() {     if (currencyid == 2)     {         currencysymbol = "€";     }     else     {         currencysymbol = "$";     }  } 

and javascript variable

var currencysymbol = "<%=currencysymbol%>"; 

the setcurrencysymbol method called in if(!page.ispostback) condition.

here dropdownlist code

<asp:dropdownlist runat="server" id="ddlcurrency" onselectedindexchanged="ddlcurrency_onselectedindexchanged" autopostback="true" onchange="setcurrencysymbol"> </asp:dropdownlist> 

that javascript variable needs set c# value after new item selected dropdown. original value when page loaded retained after new selection made however. appreciated. in advance.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -