开发者

How do I get the route user\22\edit in ASP.NET MVC

So I have my route setup for accepting something like 开发者_StackOverflow中文版user\22\edit where 22 is the ID of the user we are editing. I can type this into the URL bar in my browser and things are good to go. My questions though is how can an ActionLink on a view to have that same URL structure when clicked?

Thanks


see http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx


Your problem is with your routes. The html actionlink helper will choose the first route that can match the values you supply. If you add a route something like this:

"User/{id}/Edit", new { controller = "User", action = "Edit", id = "" }

Before the default route, and any other route that might be able to match your values and your good to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜