html helper - ASP.NET MVC ActionLink renders erroneously -


so community

i have following issue:

if render actionlink this:

@html.actionlink(titletext,      title.href.targetaction,      title.href.targetcontroller,      title.href.targetroutevalues,      null) 

the rendered element is:

<a href="/eagle/intervention/edit_inv?id_inv=53165">        19/      2013</a> 

but if add object htmlattributes this:

@html.actionlink(titletext,      title.href.targetaction,      title.href.targetcontroller,      title.href.targetroutevalues,      new {target="_blank"}) 

i following markup:

<a href="/eagle/intervention/edit_inv?count=1&amp;keys=system.collections.generic.dictionary%602%2bkeycollection%5bsystem.string%2csystem.object%5d&amp;values=system.collections.generic.dictionary%602%2bvaluecollection%5bsystem.string%2csystem.object%5d" target="_blank">        19/      2013</a> 

what options here?

thanks in advance, silviu.

well, quick! cracked it:

@html.actionlink(titletext,        title.href.targetaction,        title.href.targetcontroller,       title.href.targetroutevalues,        new dictionary<string, object> { { "target", "_blank" } }) 

this got me out. instead of providing anonymous object htmlattributes, used idictionary, , works charm.

thanks interest, however, nick, solution not valid ;)


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -