使用ASP.NET MVC 4中的更新面板(using update panel in ASP.NET MVC 4)

请解释我如何在ASP.NET MVC4应用程序中创建更新面板。 我寻找了很多博客......但找不到任何有用的方法。 这是我的看法

我如何在相同视图中分离这些操作?

Please explain me how to create update panel in ASP.NET MVC4 application. I looked for many blogs... but can not find any useful way. This is my view

How I can separate these actions in same view?

最满意答案

您的两个面板不允许用户在其中一个或另一个之间切换,因此我假定您有一个“前奏”视图,并且可以选择登录或注册。 对? 在这种情况下,不需要使用Javascript / Ajax进行客户端面板切换。 您的“介绍”视图可以将参数传递给控制器​​操作,以定义是否需要登录或注册视图。

例如:

// 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 }

Your two panels don't allow the user to switch between one or the other so I assume that you have an "intro" view with the option to either Sign in or Register. Right? In that case there is no real need for client side panel switching using Javascript/Ajax. Your "intro" view can pass a parameter to the controller action defining whether it needs a Sign In or Register view back.

For instance:

// 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 4中的更新面板(using update panel in ASP.NET MVC 4)

请解释我如何在ASP.NET MVC4应用程序中创建更新面板。 我寻找了很多博客......但找不到任何有用的方法。 这是我的看法

我如何在相同视图中分离这些操作?

Please explain me how to create update panel in ASP.NET MVC4 application. I looked for many blogs... but can not find any useful way. This is my view

How I can separate these actions in same view?

最满意答案

您的两个面板不允许用户在其中一个或另一个之间切换,因此我假定您有一个“前奏”视图,并且可以选择登录或注册。 对? 在这种情况下,不需要使用Javascript / Ajax进行客户端面板切换。 您的“介绍”视图可以将参数传递给控制器​​操作,以定义是否需要登录或注册视图。

例如:

// 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 }

Your two panels don't allow the user to switch between one or the other so I assume that you have an "intro" view with the option to either Sign in or Register. Right? In that case there is no real need for client side panel switching using Javascript/Ajax. Your "intro" view can pass a parameter to the controller action defining whether it needs a Sign In or Register view back.

For instance:

// 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 }