How to unpack htmlAttributes in a span tag in ASP.NET MVC

Posted by sleepy on Stack Overflow See other posts from Stack Overflow or by sleepy
Published on 2010-04-01T00:41:03Z Indexed on 2010/04/01 0:43 UTC
Read the original article Hit count: 275

Filed under:

I have htmlAttributes generated - originally for the purpose of creating a link with the attribute using Html.ActionLink.

Now, based on some condition, I would like to create a <span> tag instead and put the attributes in there. Is there anyway it can be done easily ?

Eg: something like:

<span <%= htmlAttributes.Unpack() %> > Some txt </span>

OR

<%= Html.SpanTag("Some txt", htmlAttributes) %>

OR anything similar without wresling too much with the already generated htmlAttribues?

Thanks

© Stack Overflow or respective owner

Related posts about asp.net-mvc