0

I am trying to show a validation message on click of a save button if the page has no errors, can anyone tell me why I'm unable to access the CssClass property of validationMessage in this instance?

<div id="validationMessage" ClientIDMode="Static" runat="server" class="hidden">
    Please fix any errors on the page before saving.
</div>


protected void cmdSave_Click(object sender, EventArgs e)
{
    if (Page.IsValid)
    {
    //stuff
    }
    else
    {
        validationMessage.CssClass = validationMessage.CssClass.Replace("hidden", "");
    }
}
Salah Akbari
  • 39,330
  • 10
  • 79
  • 109
noclist
  • 1,659
  • 2
  • 25
  • 66

0 Answers0