Hi I am new to MVC I am trying to disable a button if a few textboxfor fields are not entered or are null. I have tried the following code below but no luck, I get an object null error.
@if (String.IsNullOrEmpty(modelData.Email))
{
<input type="submit" class="btn btn-default" value="Register" onclick="JavascriptFunction()" disabled="disabled" />
}
else
{
<input type="submit" class="btn btn-default" value="Register" onclick="JavascriptFunction()" />
}
HTML Text box definition
@Html.TextBoxFor(m => m.Email, new { @placeholder = "example: dlamini@gmail.com", @class = "form-control", id = "message", onkeypress = "capLock(event)" })
This happens when the Registration.cshtml
page loads, please assist.