I have a list view for one of my controller's index action. In that View's source, I have added the following code to the for loop present inside the source of View.
Thus i will get a link named "Select" against each of the entry present on this View. But I can't pass the parameters to my controll开发者_运维百科er action using above code.
How can i do this - passing parameters to Controller-Action using action link Click?
Regards, Kapil
This will work for your case:
<%=Html.ActionLink("Select","ActionName","Home",new { iID1 = Convert.ToInt32(ViewData["ID"].ToString()), iID2 = Convert.ToInt32(item.Id) },null)%>
null is the httml attribute you want to set for the link like new {class="CSSClassforthelink"}
精彩评论