How to work with Action Link when using CSS


Tags: asp.net-mvc,html5,css3,razor,asp.net-mvc-4

Problem :

<li class="rtsLI" id="Summary"><a href="javascript:void(0);" onclick="javascript:rtsXXX.OnClientTabSelected(this‌​, 0);" class="rtsLink"><span class="rtsTxt">Test</span></a></li> 

Above I am replacing with following actionlink:

<li class="rtsLI" >@Html.ActionLink("test1", "Index", new { Area = "Area1", Controller = "controller1" }, new { @class = "rtsLink rtsTxt"})</li> "

At first css is working fine. But when using Actionlink, css not working. Thanks



Solution :

Best option will be to use @Url.Action extension method

<li class="rtsLI" id="Summary"><a href="@Url.Action("Index", new { Area = "Tools", Controller = "UserSecurity" })" class="rtsLink"><span class="rtsTxt">User Security</span></a></li>

    CSS Howto..

    How to apply css class for selected element in jquery or javascript?

    How to use google font

    How to change font-color for disabled input?

    How to avoid double border from the multiple
  • how to make a div stay in a div

    How to Remove - Modify btn-inverse Top Border

    PHP - How to change the class of a link

    How is margin-top and margin-bottom getting added

    How to apply an inner stroke to an image with just CSS?

    Why does the Jcrop-tracker not show it's correct position?

    How to place 2 div side by side (alternative solution)

    How to stop a CSS rule from applying to a specific element [duplicate]

    How to fit height of aside to body height

    How to preload large css and javascript files in vanilla javascript

    How can I make clickable list with sublinks ?

    CSS - how to code for a specific resolution

    How to make right and bottom css properties work on a textarea in IE? (IE9 and below)

    How to make css opacity property not to be inherited from parent div´s?

    how to make a h2 background image 'dynamic' in height as well

    How can I eliminate the space above my list?

    How can I hide a button when scrolled to the top of a page?

    How to prevent mobile keyboard from rising footer over the text fields?

    How to get variable`s value of CSS from database in yii?

    how to align an 'a' element in html/css

    How to change property of a specific CSS pseudo element?

    how to make a drop down menu fixed from the top with css?

    How to center social buttons in bootstrap login page?

    Showing refresh button when animation is complete?

    CSS - How to show only a % of the top div with two identicals divs stacked over each other

    When I click on each button its shows me the same content of the first button