I’m having a problem with a jQuery method being called from code behind when using a RequiredFieldValidator. This works great without the RequiredFieldValidator on the form. When it’s on the form, I get an error:
Microsoft JScript runtime error: Object doesn’t support property or method ‘toastmessage’
as if it hasn’t loaded the jquery.js file.
As a test, I have a simple page that has a TextBox on it and a button within an UpdatePanel. When you click the button, it fires the server side OnClick method with the following code:
ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", @"$().toastmessage('showWarningToast', 'Record Saved Successfully.'); ", true);
This works great, and pops the message. When I attach a RequiredFieldValidator to the TextBox is when the error pops up. Does anyone have any ideas what might be causing this?
Add this to your Required Field Validator: