Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.validationsummary.showmessagebox.aspx" rel="nofollow noreferrer">ShowMessageBox</a> option is fully client-side, so it will only evaluate if you have set the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.clientvalidationfunction.aspx" rel="nofollow noreferrer">ClientValidationFunction</a> on the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx" rel="nofollow noreferrer">CustomValidator</a>.</p> <p>You can also fake it by registering a script that makes an alert, so when you get back from the server's validation, it'll prompt with the error message. This can either be registered in the ServerValidate method (per <a href="https://stackoverflow.com/questions/811734/elegant-way-to-make-customvalidator-work-with-validationsummary-messagebox/811761#811761">@Jose Basilio</a>), or you can call the following method during the PreRender event to register a popup with all invalid validators on the page: </p> <pre><code> /// &lt;summary&gt; /// Registers a script to display error messages from server-side validation as the specified &lt;see cref="UserControl"/&gt; or &lt;see cref="Page"/&gt; loads from a postback. /// &lt;/summary&gt; /// &lt;remarks&gt; /// Must be called in the PreRender if used to validate against the Text property of DNNTextEditor controls, otherwise Text will not be populated. /// Must set the ErrorMessage manually if using a resourcekey, otherwise the resourcekey will not have overridden the ErrorMessage property. /// &lt;/remarks&gt; /// &lt;param name="ctrl"&gt;The &lt;see cref="UserControl"/&gt; or &lt;see cref="Page"/&gt; which is being posted back.&lt;/param&gt; /// &lt;param name="validationGroup"&gt;The validation group against which to validate.&lt;/param&gt; public static void RegisterServerValidationMessageScript(TemplateControl ctrl, string validationGroup) { if (ctrl != null &amp;&amp; ctrl.Page.IsPostBack) { ctrl.Page.Validate(validationGroup); if (!ctrl.Page.IsValid) { StringBuilder errorMessage = new StringBuilder("&lt;script language='javascript'&gt;alert('"); for (int i = 0; i &lt; ctrl.Page.Validators.Count; i++) { IValidator validator = ctrl.Page.Validators[i]; if (!validator.IsValid) { errorMessage.Append("- " + validator.ErrorMessage); if (i &lt; ctrl.Page.Validators.Count - 1) { errorMessage.Append(@"\r\n"); } } } errorMessage.Append("');&lt;/script&gt;"); ctrl.Page.ClientScript.RegisterStartupScript(typeof(IValidator), "validationAlert", errorMessage.ToString(), false); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload