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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:34:18+00:00 2026-05-24T01:34:18+00:00

I ve been looking for a straight forward way to prompt error messages, ideally

  • 0

I ve been looking for a straight forward way to prompt error messages, ideally a popup, (javascript or otherwise) to users failing the login system on this form:

@model Blog.Models.ViewModels.LoginView
<!DOCTYPE html>
<html>
<body>
@using (Html.BeginForm()) {
<p>Your name: @Html.TextBoxFor(x => x.name) </p>
<p>Your password: @Html.TextBoxFor(x => x.password)</p>
    <input type="submit" value="Login" />    
}
</body>
</html>

but most examples I ve found use the onclick method on a label. Instead i want it to be handled by this controller:

private BlogModel model = new BlogModel();
[HttpPost]
    public ActionResult LoginForm(string name, string password)
    {
                SysUser user = model.SysUsers.Where(x => x.SysUserName == name).First();
                {
                    if (user != null && user.SysPassword == password)
                    {
                        Session["usrn"] = name;
                        return RedirectToAction("LoginSuccessful", "Users");
                    }
                    else
                    {
                        //display error//
                    }
                }
  • 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-24T01:34:20+00:00Added an answer on May 24, 2026 at 1:34 am

    I would recommend against a popup or alert() dialog. Instead, I would use a styled div to display your error messages. If you’re using jQuery UI, you could try my message plugin. Since its displayed with javascript, you can use it like so:

    Controller:

    [HttpPost]
    public ActionResult LoginForm(string name, string password)
    {
        SysUser user = model.SysUsers.Where(x => x.SysUserName == name).First();
        {
            if (user != null && user.SysPassword == password)
            {
                Session["usrn"] = name;
                return RedirectToAction("LoginSuccessful", "Users");
            }
            else
            {
                ViewBag.LoginError = true;
            }
        }
    }
    

    Markup with jquery-message:

    <div id="loginError" style="display:none">Login Error...</div>
    
    @if (ViewBag.LoginError == true)
    {
        <script type="text/javascript">
            $("#loginError").message({type:"error"});
        </script>
    }
    

    Or if you prefer, without jquery-message:

    @if (ViewBag.LoginError == true)
    {
        <div id="loginError" class="error">Login Error...</div>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure my question is pretty straight forward, and I've been looking for an
I've been looking around for a way to store an NSArray containing lots of
I've been looking around for a way to programmatically parse XSD files to generate
This should be very straight forward, but even looking at the other questions, I
Been looking around a bit and I can't seem to find any help on
Been looking everywhere, I just can't seen to find it (probably because I'm wording
Been looking through other answers and I still don't understand the modulo for negative
I´ve been looking for it yet in stackoverflow without success... Is it posible a
Ive been looking for a jQuery menu with a slide down effect like Yoothemes.
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only

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.