ValidationSummary ShowMessageBox fails

2 posts, 0 answers
  1. Jugoslav
    Jugoslav avatar
    59 posts
    Member since:
    Mar 2011

    Posted 22 Jul 2013 Link to this post

    This is the complete code that i am testing and as mentioned in the subject line it does not work as expected

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestPage.aspx.vb" Inherits="TestDotNet45Site.TestPage" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html>
    <head runat="server">
        <title>Contact Us</title>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <div class="ContactPage">
            <h1>Contact Us (Please Fill Out The Contact Form Below)</h1>
            <h2><b>Important note:</b> Yahoo, Microsoft and other free email providers often class our emails as spam/junk, so please check your spam/junk folder if you do not hear from us in a timely manner.</h2>
                <telerik:RadTextBox ID="FullNameText" runat="server" EmptyMessage="Your Name" Resize="None" Width="400px" Skin="MetroTouch" />
                <telerik:RadTextBox ID="EmailText" runat="server" EmptyMessage="Your E-mail" Resize="None" Width="400px" Skin="MetroTouch" />
                <telerik:RadTextBox ID="SubjectText" runat="server" EmptyMessage="Subject" Resize="None" Width="400px" Skin="MetroTouch" />
                <telerik:RadTextBox ID="MessageText" runat="server" EmptyMessage="Your Message" Resize="None" Width="500px" Skin="MetroTouch" TextMode="MultiLine" Height="120px" />
                <telerik:RadButton ID="SendMessageButton" runat="server" Text="Send" Skin="MetroTouch" Width="110px" CausesValidation="true" ValidationGroup="MyInquiryForm"></telerik:RadButton>
            <p><b>All fields are mandatory!</b> <asp:Label ID="TestLabel" runat="server" /> </p>
                <asp:RequiredFieldValidator ID="RequiredFullNameText" runat="server" ErrorMessage="Full Name is mandatory!" ControlToValidate="FullNameText" Display="None" ValidationGroup="MyInquiryForm">*</asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredEmailText" runat="server" ErrorMessage="E-Mail is mandatory!" ControlToValidate="EmailText" Display="None" ValidationGroup="MyInquiryForm">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularEmailText" runat="server" ErrorMessage="Please enter a valid e-mail address!" ControlToValidate="EmailText" Display="None" ValidationGroup="MyInquiryForm" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                <asp:RequiredFieldValidator ID="RequiredSubjectText" runat="server" ErrorMessage="Subject is mandatory!" ControlToValidate="SubjectText" Display="None" ValidationGroup="MyInquiryForm">*</asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredMessageText" runat="server" ErrorMessage="Message is mandatory!" ControlToValidate="MessageText" Display="None" ValidationGroup="MyInquiryForm">*</asp:RequiredFieldValidator>
                <asp:ValidationSummary ID="ContactValidationSummary" runat="server" ShowSummary="false" ShowMessageBox="true" HeaderText="Please notice that:" ValidationGroup="MyInquiryForm" DisplayMode="BulletList" />

    I just tested the VERY SAME code in an older project which is not a "Web Aplication" like this one.
    Rather it's a website project and the code from above worked like a charm showing the messagebox. Not sure if it's your libraries or i miss something on my end?
    Thank you

    P.S. the problem is that when i click the Send button with all fields empty it cause postback instead to show the msgbox on client-side :(
  2. Jugoslav
    Jugoslav avatar
    59 posts
    Member since:
    Mar 2011

    Posted 23 Jul 2013 Link to this post

    Thanks to Blair i found the solution.

    It turned out to be a web.config setting:

    <httpRuntime targetFramework="4.5"/>

    This setting turns off Javascript injection of validation (client side) and enables (but doesn't turn on) html5 injection of validation (client side).  Google unobtrusive validation for details on the new 4.5 methods.

    Removing this key from my application fixed the problem.

  3. DevCraft R3 2016 release webinar banner
Back to Top