can we print error message before form start, I am using mvc v4
this is my controller action code [HttpGet]
public ActionResult ChangePassword(string aToken)
{
aToken = Server.UrlDecode(aToken);
if (aToken != null)
{
.........
}
else
{
ViewBag.Error = "Sorry, this link is not being recognized as valid.
}
return view();`enter code here`
}
this is my cshtml file
@if (ViewBag.Error != null)
{
<p class="text-danger">
@ViewBag.Error
</p>
}
else
{
using (Html.BeginForm("ChangePassword", "Account", FormMethod.Post, new {
@class = "form-horizontal ", role = "form" }))
{
........................
}
}`enter code here`
technicality, is this correct?