I just started using MVC. I simply want to emulate Label.Text = "some string" in MVC. How can I achieve this?
I tried this
Model
public class UserLogin
{
    [Required]
    [Display(Name = "Username")]
    public string UserName { get; set; }
    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }
    public string ErrorMsg { get; set; } /*I want to dynamically change the value of the error message*/
}
Controller
 public ActionResult Index(UserLogin model, string returnUrl)
    {
    model.ErrorMsg="Invalid Login"
    return View(model)
    }
View
<div class="pure-control-group">
            @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")
            @Html.ValidationMessageFor(m => m.UserName)
            @Html.ValidationMessageFor(m => m.Password)
            @Html.Label(Model.ErrorMsg);
        </div>
I keep on getting the error Object reference not set to an instance of an object. Thanks!
