如何根据web.config设置

时间:2016-01-11 02:41:56

标签: c# asp.net-mvc razor web-config

虽然,我可以检查剃刀视图中的web.config设置;即如果<add key="UnobtrusiveJSEnabled==false" value="true" />设置为true或false或null,但如何在剃刀视图中发出自定义帮助器和脚本管理器?

如果@HTML.MyCustom.DDL()

,我想要添加自定义UnobtrusiveJSEnabled==false
@if (System.Web.Configuration.ConfigurationManager.AppSettings["UnobtrusiveJSEnable"] == "false")
  {        
    // how to include the custom helper here?  
    @HTML.MyCustom.DDL();  // does not render to the view??
    @HTML.MyCustom.ScriptManager(); // does not render to the view??
  }

0 个答案:

没有答案