How to format the mvc helpers according to my Bootstrap layout?

1

I'm trying in many ways to adjust the layout according to the Helpers

          <!-- rightpanel3  -->
            <div data-role="panel" id="opcoesusuario" data-position="right" data-display="overlay" data-theme="a">


            <a  class="ui-btn ui-mini" data-rel="close" data-transition="flip"  data-role="button" >@Html.ActionLink("Perguntas ","index","PerguntasRespondidas")</a>




      </div><!-- /rightpanel3 -->   
    
asked by anonymous 14.07.2015 / 04:29

1 answer

0

You can pass the parameters as htmlAttributes.

To do this, use the @Html.ActionLink("texto ancora", "Action", "Controller", new { htmlAtributtes })

Example:

@Html.ActionLink("Perguntas", "Index", "PerguntasRespondidas", new { @class="ui-btn ui-mini", data_rel="close", data_transition="flip",  data_role="button"  })

Comments:

  • The word class is a reserved word. So when passing a css class like htmlAttribute use the @class="sua-classe" syntax the MVC will know how to render it in the View.

  • htmlAttributes is a object for the compiler, so the name of your property can not count some characters. such as the hyphen. Therefore the data- attributes of the html should be written as data_ . Again, MVC does its part and renders as data-

  • Soon the above example would be rendered as:

    <a class="ui-btn ui-mini" data-rel="close" data-role="button" data-transition="flip" href="/PerguntasRespondidas/Index/">Perguntas</a>
    

    Example: link

        
    16.07.2015 / 00:12