开发者

getting the id value of current url in asp.net mvc 2.0

i am using a actionlink in master page of user module.i want to pass the eventid of the current url(in all views) to the actionlink as a route value.But i use the following code,

<%=Html.ActionLink("Create Account", "UserRegistration",
      new { eventid = ViewContext.RouteData.Values["id"] })%>

But it doesnot retrieve the id fom the url.

my url is in following formate,

htt开发者_如何学JAVAp://localhost:12905/User/User/Order?eventID=2

here eventID=2 is common for all views.So i want to send this eventID to the actionlink as route value. Thanks in advance,


Shouldn't that be "eventId" instead of "id" in the ActionLink:

<%= Html.ActionLink(... ViewContext.RouteData.Values["eventId"] })%>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜