请解释一下如何在 ASP.NET MVC4 应用程序中创建更新面板。我找了很多博客...但找不到任何有用的方法。 这是我的看法
如何在同一个 View 中分离这些操作?
最佳答案
您的两个面板不允许用户在其中一个或另一个之间切换,因此我假设您有一个“介绍” View ,可以选择登录或注册。正确的?在这种情况下,实际上不需要使用 Javascript/Ajax 进行客户端面板切换。您的“介绍” View 可以将参数传递给 Controller 操作,定义它是否需要登录或注册 View 。
例如:
// RouteConfig.cs
routes.MapRoute(
name: null,
url: "login-register/{action}",
defaults: new { controller = "Authentication"},
constraints: new { action = @"(SignIn|Register)" }
);
// AuthenticationController.cs
public ActionResult SignIn()
{
...
return View(); // Will return the Authentication\SignIn.cshtml view
}
public ActionResult Register()
{
...
return View(); // Will return the Authentication\Register.cshtml view
}
关于asp.net-mvc - 在 ASP.NET MVC 4 中使用更新面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15850875/