如何在JavaScript中使用web.config中的AppSetting?

时间:2017-04-05 13:23:07

标签: javascript jquery html web-config

我有一个web.config AppSetting值,我需要在我的JS文件中使用它。我在我的HTML文件中使用此代码,我无法在JS中检索我的变量。

<script>
  var appSettingValue = '@System.Configuration.ConfigurationManager.AppSettings["AccountsAuditMetricID"]';
  // '<%=System.Configuration.ConfigurationManager.AppSettings["AccountsAuditMetricID"]%>';
  // The variable "appSettingValue" will contain the string from your web.config
</script>

我的页面中有这个按钮,我需要隐藏某些情况:

attributes: { 
  'class': 'k-grid-update', 
  'style': "#= metric_fk == $('#appSettingValue') ? 'display: none' : '' #" 
}

我需要一些帮助,看看如何在我的JS中使用我的web.config。这是我的配置:

<appSettings>
  <add key="AccountsAuditMetricID" value="8"/>
</appSettings>

0 个答案:

没有答案
相关问题