开发者

Post an a href value to controller in asp.net mvc

开发者 https://www.devze.com 2023-01-03 00:59 出处:网络
I want to send the id value oftag to controller when user click on any link. TempString1.Append(\"<li><a id=\"+aa[i].int_FeatureId+\" href=../\" + aa[i].Feature.vcr_LinkName + \">\" + aa[

I want to send the id value of tag to controller when user click on any link.

TempString1.Append("<li><a id="+aa[i].int_FeatureId+" href=../" + aa[i].Feature.vcr_LinkName + ">" + aa[i].Feature.vcr_FeaturesName + "&开发者_开发知识库lt;/a></li>");


In ASP.NET MVC you usually use Html.ActionLink or the like.

But to stay in your line, how about:

href=../" + aa[i].Feature.vcr_LinkName + "&featureId=" + aa[i].int_FeatureId + "

and in your controller:

public ActionResult ActionName(string id, int featureId)
...
0

精彩评论

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