本文介绍了从一名ActionLink的输出正确的URL有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图输出使用ASP.Net MVC3框架下面的URL,我是一个总的小白在这个东东:

I am trying to output the following URL using the ASP.Net MVC3 framework and I am a total noob at this stuff:

下面是我的code迄今:

Here is my code so far:

@Html.ActionLink("Click here!", "action", new { Controller = "controller" })

这给了我:

我需要什么,最后才能得到一个简单的硬$ C $光盘1张在那里?

What do I need to get a simple hardcoded 1 in there at the end?

推荐答案

要指定路由参数,你需要使用以下签名

To specify route parameters you'll need to use the following signature

@Html.ActionLink("Click here!", "action", "controller", new {id = 1}, null })

在年底重新$ P $空psents,你可以,如果你指定HtmlAttributes像

The null at the end represents the HtmlAttributes which you can specify if you like

此外结帐这个为ActionLink的如何成为一个伟大的说明使用

Also checkout this question "HTML.ActionLink method" for a great description of how ActionLink should be used

这篇关于从一名ActionLink的输出正确的URL有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 07:35