ActionLink htmlAttributes with hyphens

The problem is that your anonymous object property data-icon has an invalid name. C# properties cannot have dashes in their names. There are two ways you can get around that: Use an underscore instead of dash (MVC will automatically replace the underscore with a dash in the emitted HTML): @Html.ActionLink(“Edit”, “edit”, “markets”, new { id … Read more

Create an ActionLink with HTML elements in the link text

You could use Url.Action to build the link for you: <a href=”https://stackoverflow.com/questions/402605/<% =Url.Action(“Action”, “Controller”)%>”>link text <span>with further blablah</span></a> or use Html.BuildUrlFromExpression: <a href=”https://stackoverflow.com/questions/402605/<% =Html.BuildUrlFromExpression<Controller>(c => c.Action()) %>”>text <span>text</span></a>

ASP.NET MVC – Pass array object as a route value within Html.ActionLink(…)

Try creating a RouteValueDictionary holding your values. You’ll have to give each entry a different key. <% var rv = new RouteValueDictionary(); var strings = GetStringArray(); for (int i = 0; i < strings.Length; ++i) { rv[“str[” + i + “]”] = strings[i]; } %> <%= Html.ActionLink( “Link”, “Action”, “Controller”, rv, null ) %> will … Read more

Html.ActionLink with a specified HTML id?

You were on the right track. I am not sure why it didn’t work for you as your code has a typo which would have produced a } expected error. The following is what you are looking for: <%= Html.ActionLink(“Test Link”, “SomeAction”, “SomeController”, null, new {id = “someID” }) %> Which produces teh following HTML: … Read more

ActionLink htmlAttributes

The problem is that your anonymous object property data-icon has an invalid name. C# properties cannot have dashes in their names. There are two ways you can get around that: Use an underscore instead of dash (MVC will automatically replace the underscore with a dash in the emitted HTML): @Html.ActionLink(“Edit”, “edit”, “markets”, new { id … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)