如我有 public class ValidationController : Controller
{
//
// GET: /Validation/ public ActionResult Index(Models.User user)
{
return this.View(user);
}
}现在我想让他返回的View为我的指定的模板
如:
web.config有key <add key="TemplateName" = "Style/A/">
那么我的程序就会写为: public class ValidationController : Controller
{
//
// GET: /Validation/ public ActionResult Index(Models.User user)
{
return this.View(System.Configuration.ConfigurationManager.AppSettings["TemplateName"] + "Index", user);
}
}那么如何何写一个公共的类或怎么来改写他的View
来实现我在web.config里面定义了TemplateName
而
写
return this.View(user);
就相当于写
return this.View(System.Configuration.ConfigurationManager.AppSettings["TemplateName"] + "Index", user);
呢
谢谢
{
//
// GET: /Validation/ public ActionResult Index(Models.User user)
{
return this.View(user);
}
}现在我想让他返回的View为我的指定的模板
如:
web.config有key <add key="TemplateName" = "Style/A/">
那么我的程序就会写为: public class ValidationController : Controller
{
//
// GET: /Validation/ public ActionResult Index(Models.User user)
{
return this.View(System.Configuration.ConfigurationManager.AppSettings["TemplateName"] + "Index", user);
}
}那么如何何写一个公共的类或怎么来改写他的View
来实现我在web.config里面定义了TemplateName
而
写
return this.View(user);
就相当于写
return this.View(System.Configuration.ConfigurationManager.AppSettings["TemplateName"] + "Index", user);
呢
谢谢
public ActionResult Index(Models.User user)
{
return this.View(Config.TemplateName, user);
}
这样来使用了
我就是不想再写
return this.View(Config.TemplateName, user);
而是
return this.View(user);
还有你这里面还得加上Action名
return this.View(Config.TemplateName+"Index", user);
得这样,所以感觉麻烦谢谢