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 make image control button for each image inside the div using css and js?

    Overlay image to show like panorama [closed]

    How to make a header ribbon responsive

    How to do transparent background on few div to see background of parent

    CSS: how to make margin: 0px auto work

    How can i put this SVG ‘Sidebar Menu’ in the right side?

    How to grouply select multi elements CSS?

    How to dynamically apply nested base languages in textarea?

    How to develop Javascript and CSS and use minified versions when releasing?

    How should I handle this CSS Inheritance conundrum?

    I'm am trying to have a responsive navigation bar for small screens, how can I change the left links to a css drop-down menu?

    How do I get jQuery to change classes according to an If/Then statement. My 'home' link will not change class when another link clicked on

    How to jump to specific sections of a sprite sheet in css?

    How to add custom css class for each page?

    how to not inherit? or how to reset inherited width to the value before? (css)

    HTML & CSS: How to put quotation mark and text in same height?

    How do I link an external css to overwrite bootstrap css for centering elements?

    Building a DOS-feel script. How to make the command line?

    How can i place a child div on a fixed position of a parent div that when i change place of parent then child should move automatically?

    How to align multiple columns in bootstrap 3 carousel?

    How to reduce div size in CSS using twitter bootstrap?

    How to select the second paragraph after another with css?

    How to change color of text based on the php condition [closed]

    DIV Background Image Doesn't Show in Firefox or Chrome (But only online). Online it works for IE?

    How to keep images fixed but also responsive so they don't overlap

    How to fill an element 100% vertically with children only with CSS?

    How to achieve this CSS layout? [closed]

    Blueprint CSS - Link showing both URL and text

    css animation how to get the ball to bounce

    How to center something I appended with js and also replace it