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

RadInput_Error_Default not occurring

1 Answer 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 10 Nov 2011, 08:31 PM
Telerik, 

I've got a regex control attached to a text box validating  a list of email addresses. When the set of email addresses is invalid a water mark appears in the textbox with a message 'Invalid email' displaying in black font.  It should be red font, but it looks like the radInput_error_default event is not being triggered and associated with the css that displays red font.  The css that is being used is the '.RadInputMgr_Default' with a color = black.  Below is the code for a sample application that does work.  Note the ajax toolkit script manager is being used.  

Can you shed any insight into this problem?

Peter

Not working application(abbreviated)
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Masters/FullMaster.master"
    CodeBehind="Edit.aspx.cs" Inherits="main.Prospect.Edit" Title="Edit Prospect"
    Buffer="true" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" runat="server">    
    <ajax:ToolkitScriptManager runat="server" ID="ScriptManager" OnAsyncPostBackError="ScriptManagerAsyncPostBackError"
        AllowCustomErrorsRedirect="true">
    </ajax:ToolkitScriptManager>
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
        <TargetControls>
            <telerik:TargetControl ControlsToApplySkin="RadGrid" Skin="Metrolist" />
        </TargetControls>
    </telerik:RadSkinManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" EnableEmbeddedSkins="false" runat="server"
        DecoratedControls="CheckBoxes" Skin="Metrolist" />
    <div id="prospectContainer">
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="700px">                
            <table class="prospect">                            
                <tr class="LineTop">
                    <td class="controls">
                        <table>
                            <tr>
                                <td>
                                    <asp:TextBox ID="EmailTextbox" runat="server" Width="300px"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                                                   
            </table> 
            <telerik:RadInputManager ID="RadInputManager1" runat="server" OnValidating="RadInputManagerValidating"
                EnableViewState="false"  >
                <telerik:RegExpTextBoxSetting BehaviorID="EditEmailTextBoxBehavior" IsRequiredFields="true" 
                    ValidationExpression="^([\w+-.%]+@[\w-.]+\.[A-Za-z]{2,4},? ?)+$" ErrorMessage="Incorrect email format">
                    <TargetControls>
                        <telerik:TargetInput ControlID="EmailTextbox" />
                    </TargetControls>
                    <Validation IsRequired="true" ValidationGroup="EditProspectInfoValidationGroup" ValidateOnEvent="Submit" />
                </telerik:RegExpTextBoxSetting>               
            </telerik:RadInputManager>
        </telerik:RadAjaxPanel>
    </div>   
</asp:Content>


Working application:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Test.WebForm1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>


</head>
<body>
    <form id="form1" runat="server">
    <ajax:ToolkitScriptManager runat="server" ID="ScriptManager"         AllowCustomErrorsRedirect="true">
    </ajax:ToolkitScriptManager>
    <div>
        <asp:TextBox ID="EmailTextbox" runat="server" Width="300px"></asp:TextBox>
    </div>
      <%--<telerik:RadScriptManager runat="server" ID="RadScriptManager1">        
        <CdnSettings TelerikCdn="Enabled" />
        <Scripts>
            <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                Name="MicrosoftAjax.js" Path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js" />
        </Scripts>
    </telerik:RadScriptManager>--%>
    <telerik:RadInputManager ID="RadInputManager1" runat="server" EnableViewState="false"  >
           <telerik:RegExpTextBoxSetting BehaviorID="EditEmailTextBoxBehavior" IsRequiredFields="true" 
                    ValidationExpression="^([\w+-.%]+@[\w-.]+\.[A-Za-z]{2,4},? ?)+$" ErrorMessage="Incorrect email format">
                    <TargetControls>
                        <telerik:TargetInput ControlID="EmailTextbox" />
                    </TargetControls>
                    <Validation IsRequired="true" ValidationGroup="EditProspectInfoValidationGroup" ValidateOnEvent="Submit" />
                </telerik:RegExpTextBoxSetting>
    </telerik:RadInputManager>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 14 Nov 2011, 03:36 PM
Hello Peter,

I tested the first code snippet that you wrote and the styles are applying right here. I just removed the
RadInputManager1's OnValidating and ScriptManager's OnAsyncPostBackError events since you didn't post their code. Please check their code for some modifying of the styles or eventual errors. I also see that you don't use OnValidating in the working version of the code, I don't see other significant differences, so this could really be the issue.

Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or