开发者

How to pass parameters to Controller-Action using LinkButton Click

开发者 https://www.devze.com 2022-12-11 03:36 出处:网络
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.

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"}

0

精彩评论

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