Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7072311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:47:36+00:00 2026-05-28T05:47:36+00:00

I used to put the class of css in the action link like this:

  • 0

I used to put the class of css in the action link like this:

<%: Html.ActionLink("Us", "Us", "Por", new { @class = "contactus" })%>

The purpose that I put the class is for the pop up of color box.
Now I have an action in my controller that return the result to the view like this :

return Redirect(@"~/Test/TestFirst?msg=Please complete all the information.");

Question : How can I add class = “contactus” to the return of my action ?

Thanks in advanced.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:47:37+00:00Added an answer on May 28, 2026 at 5:47 am

    The Controller cannot and should not add css classes, this is the views responsibility. And it looks like you are stuffing a message in the query string, but it probably should be in the TempData

    Controller:

    TempData["msg"] = "Please complete all the information";
    return Redirect(@"~/Test/TestFirst");
    

    View:

    @if(TempData["msg"] != null)
    {
      <div class="myclass">@TempData["msg"]</div>
    }
    

    notice that TempData will survive a redirect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have HTML that looks like this: <div class=item-list> <h3>Monday Sep 21</h3> <h3>Tuesday Sep
I have used PHP array for HTML select, then I put my codes in
I use the CSS Sprite Technique with a background image that looks something like
I used the following code to put a watermark, this is located at but
I'm new to JQuery, so this is probably a very dumb question. I've used
Okay this is the css code I put on the master page so it
Is anyone used put, get, post, delete annotations(https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Controller/Annotations/) in controller. I'm trying to use
So I have a anonymous type which I have used ToString on, and put
When I first started working with Qt, it was extremely annoying that every class
My HTML first: <ul class=moreLinks > <div>More from Travelandleisure.com</div> <li><a rel=nofollow href=>xyz1</a></li> <li><a rel=nofollow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.