javascript - Accessing JS variable in Razor and Aspx -



javascript - Accessing JS variable in Razor and Aspx -

this code:

<% if (somecondition) { %> var activetab = $("#mytabs").tabs("option", "active"); var language = <% mylanguages[activetab] %> ; <% } %>

mylanguages of type dictionary.

i want access mylanguages[activetab]. how do this?

try this, variable gets value of variable, @ render time :

<% if (somecondition) { %> var activetab = $("#kiosktabs").tabs("option", "active"); var language = '@html.raw(mylanguages[activekiosktab])'; <% } %>

javascript asp.net-mvc razor

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -