This is a migrated thread and some comments may be shown as answers.

ValidationSummary ShowMessageBox fails

1 Answer 169 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jugoslav
Top achievements
Rank 1
Jugoslav asked on 22 Jul 2013, 08:48 PM
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>
</head>
<body>
    <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>
        <p>
            <telerik:RadTextBox ID="FullNameText" runat="server" EmptyMessage="Your Name" Resize="None" Width="400px" Skin="MetroTouch" />
        </p>
 
        <p>
            <telerik:RadTextBox ID="EmailText" runat="server" EmptyMessage="Your E-mail" Resize="None" Width="400px" Skin="MetroTouch" />
        </p>
 
        <p>
            <telerik:RadTextBox ID="SubjectText" runat="server" EmptyMessage="Subject" Resize="None" Width="400px" Skin="MetroTouch" />
        </p>
 
        <p>
            <telerik:RadTextBox ID="MessageText" runat="server" EmptyMessage="Your Message" Resize="None" Width="500px" Skin="MetroTouch" TextMode="MultiLine" Height="120px" />
        </p>
 
        <p>
            <telerik:RadButton ID="SendMessageButton" runat="server" Text="Send" Skin="MetroTouch" Width="110px" CausesValidation="true" ValidationGroup="MyInquiryForm"></telerik:RadButton>
        </p>
         
        <p><b>All fields are mandatory!</b> <asp:Label ID="TestLabel" runat="server" /> </p>
         
        <div>
            <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" />
        </div>
    </div>
    </form>
</body>
</html>

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 :(

1 Answer, 1 is accepted

Sort by
0
Jugoslav
Top achievements
Rank 1
answered on 23 Jul 2013, 10:26 PM
Thanks to Blair i found the solution.

[quote=Blair]
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.

[/quote]
Tags
General Discussions
Asked by
Jugoslav
Top achievements
Rank 1
Answers by
Jugoslav
Top achievements
Rank 1
Share this question
or