Home Routing Issue in Asp.net mvc 5
Reply: 1

Routing Issue in Asp.net mvc 5

Muhammad Ali
1#
Muhammad Ali Published in 2017-12-07 21:28:52Z

i am working in Asp.net mvc 5. I am having issue with Html.actionlink.

@Html.ActionLink(cust.Name, "Details", "Customers", new { id = cust.Id }, 
null);

cust.name is the text displayed , Details is the method in Customers Controller and i am passing id as parameter in Details method. But issue is that i have chechked it through debugging, the control does not goes to Details method on clicking the the link(cust.name).

i have been stuck here, please help

Antony Samy Joseph
2#
Antony Samy Joseph Reply to 2017-12-13 11:33:21Z

@Html.ActionLink() in first parameter is string, so you can not use model property. Instead of using @Html.ActionLink() we can use <a/> tag.

<a href="@Url.Action("Details","Customers",new{ id = cust.Id})">@cust.Name</a>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310758 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO