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 8817577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:52:55+00:00 2026-06-14T04:52:55+00:00

I want to display a message in layout coming from child action ? How

  • 0

I want to display a message in layout coming from child action ? How can i do that ?
Like in my layout i have a login form (rendered as a child action).. so when the login fail i would like to show a message in the layout in a specific DIV. The problem is that the layout is probably rendered before the child view. Also there another problem, the layout is rendered by any controller. Any ideas ?

  • 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-06-14T04:52:56+00:00Added an answer on June 14, 2026 at 4:52 am

    You could put a validation summary in your layout somewhere. (Razor syntax):

    <div>@Html.ValidationSummary(false)</div>

    Then just decorate the viewmodel that is being passed to your login with [Required] attributes.

    public class LoginViewModel
    {
        [Required(ErrorMessage="Please enter a your user name.")]
        public string UserName { get; set; }
    
        [Required(ErrorMessage = "Please your password.")]
        public string Password{ get; set; }
    }
    

    or if you wanted to put a more general error message just leave your viewmodel properties decorated with the [Required] attribute, then in your Login controller, in the POST method do something like this:

    [HttpPost]
    public ActionResult Login(LoginViewModel viewModel)
    {
        if (!ModelState.IsValid)
        {
            ModelState.AddModelError("Error", "Sorry, your login failed, please try again.");
        }
    }
    

    that error will then show up in the validation summary.

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

Sidebar

Related Questions

I have a login form in my app. I want to display the message
Hi I have created a zend_form_element_submit. Now i want to display a confirmation message
I want to make an application that would display a message when a user
I want to display "hello" message for 3 minutes and after that it should
I want to display a prompt message when he is redirceted from a special
I want to display 404 error page for that i have made error404.php file
I want to display message box contain label and textbox and ok button and
I want to display error message or alert message after checking the condition. here
I want to display the message Hi how are you? for 1 minute using
I am doing a project in which i want to display a particular message

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.