Disqus wants me to add an attribute called data-disqus-identifier to my links, but for obvious reasons, new { @data-disqus-identifier = "article" } gives me a syntax error.
Any idea what to do in these situations?
Thanks,
Rei
Disqus wants me to add an attribute called data-disqus-identifier to my links, but for obvious reasons, new { @data-disqus-identifier = "article" } gives me a syntax error.
Any idea what to do in these situations?
Thanks,
Rei
You can pass a Dictionary<string, object> with arbitrary string keys.
The syntax will be more verbose: new Dictionary<string, object> { { "data-disqus-identifier", "article" } }.
You may want to create an extension method or a static method on a static class with a short name that takes a smaller parameter set and returns the dictionary.
<a comparer="System.Collections.Generic.GenericEqualityComparer1[System.String]" count="1" keys="System.Collections.Generic.Dictionary2+KeyCollection[System.String,System.Object]" values="System.Collections.Generic.Dictionary2+ValueCollection[System.String,System.Object]" >blah</a>`return helper.ActionLink(linkText, "Details", "Articles", null, null, "disqus-thread", new { year = year, month = month, slug = slug }, new Dictionary<string, object> { { "data-disqus-identifier", "article-" + id } } );new RouteValueDictionary(new { ... }) to the second-to-last parameter. (You need to match the overload that takes an IDictionary<string, object> htmlAttributes) You might want to put this into an extension method.In MVC 3, if you use underscore _ instead of hyphens - in your property names then MVC will automatically convert them to hyphens in the resulting HTML. So, something like this should work for you:
new { data_disqus_identifier = "article" }