简体   繁体   English

如何在MVC3剃刀视图页面中使用Goto语句?

[英]How to used Goto statement in MVC3 razor view page?

i am Develop MVC3 razor Web application. 我正在开发MVC3剃须刀Web应用程序。 View page i am try to used goto statement but do not work. 查看页面我正在尝试使用goto语句,但是不起作用。 How to write or syntax of goto statement in view page or .chtml file please help me. 如何在视图页面或.chtml文件中编写goto语句或语法? thank you for advance. 谢谢你的帮助。

I believe you are not wanting to use the goto keyword and rather navigate to (goto) a View . 我相信您不想使用goto关键字,而是导航到(转到) View

MVC uses Controllers that route HTTP requests to Views , you will need something like this in your controller: MVC使用将HTTP请求路由到Views Controllers ,您的控制器中将需要以下内容:

    public ActionResult YourWebPage()
    {
        return View("MyPage");
    }

Then you can navigate to the URL : http://YourSite/YourWebPage 然后,您可以导航到URLhttp://YourSite/YourWebPage

Which will use the View "MyPage" which points to the .cshtml file. 它将使用指向“ .cshtml文件的视图“ MyPage”。

As a tutorial, check out: http://www.asp.net/mvc 作为教程,请访问: http : //www.asp.net/mvc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM