I want to show a successfully submit message on the Index
page when user successfully submit on the Register
page.
My Register
action includes:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SaveRegister(AirlineWebApplication.Models.User User, HttpPostedFileBase file)
{
db.Users.Add(User);
db.SaveChanges();
return RedirectToAction("Index");
}
My Register
view as follows includes.
<section class="registersection">
<div class="container-fluid">
<div class="row">
<div class="signupForm">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
@using (Html.BeginForm("SaveRegister", "Users", FormMethod.Post)) {
@Html.ValidationSummary(true)
@Html.AntiForgeryToken()
<div class="editor-field">
<label>Name
@Html.EditorFor(model => model.user_name)
</label>
@Html.ValidationMessageFor(model => model.user_name)
</div>
<div class="editor-field">
<label>Password
@Html.EditorFor(model => model.password)
</label>
@Html.ValidationMessageFor(model => model.password)
</div>
<p>
<input type="submit" value="Register" />
</p>
}
</div>
</div>
</div>
</div>
</section>
How can I display the successful message "You have registered successfully" on Index
page when I press the Register
button?
</label>
in line 42/