Portuguese Question
----------------------------------------------------
Estou tentando chamar um ValidatorCalloutExtender a partir de um CustomValidator, alguém aqui já fez isso? Isso é possível? Pois no meu exemplo abaixo isso não funciona.
English Question
----------------------------------------------------
I can try to call ValidatorCalloutExtender from a CustomValidator, but it´s not work. It´s possíble? My example doesn´t work.
PLEASE HELP ME!
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class teste : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if(TextBox1.Text == "janis"){
args.IsValid = true;
}else{
args.IsValid = false;
}
}
}
I believe, from
looking at the ValidatorCallout known issues, that it only works on CustomValidators
with client-side validation (i.e., JavaScript). Here's the part of the sentence:
"...will only work for custom validators which utilize client-side validation."
Darrell Norton, MVP
Darrell Norton's Blog Please click "Mark as Answer" if this helped you.
Can you show some exemple code??
I´m having this problem too.
[:(]
Tks...
See yaa!
==============================================
André Baltieri
São Paulo - Brazil
http://www.insidedotnet.com.br/
Twitter: @andrebaltieri
==============================================
From what I've seen, you cannot use the ValidatorCalloutExtender when the CustomValidator is using a server side validation. In this case the solution is relatively simple. Instead of using a CustomValidator, try using a RegularExpressionValidator. I've
tested the following at it will work with ValidatorCalloutExtender without a postback.
If you still want to use a CustomValidator, then create a ClientValidationFunction instead of a server side function. The following demonstrates an example of this.
Thiago Santos
0 Points
1 Post
ValidatorCalloutExtender + CustomValidator - It´s possible?
Dec 14, 2006 09:42 PM|LINK
WHERE´S THE ValidatorCalloutExtender?
Portuguese Question
----------------------------------------------------
Estou tentando chamar um ValidatorCalloutExtender a partir de um CustomValidator, alguém aqui já fez isso? Isso é possível? Pois no meu exemplo abaixo isso não funciona.
English Question
----------------------------------------------------
I can try to call ValidatorCalloutExtender from a CustomValidator, but it´s not work. It´s possíble? My example doesn´t work. PLEASE HELP ME!
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
teste.aspx
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="teste.aspx.cs" Inherits="teste" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:CustomValidator ID="CustomValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="weadsasdsa" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator> <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome" TargetControlID="CustomValidator1" runat="server"></ajaxToolkit:ValidatorCalloutExtender> <asp:Button ID="Button1" runat="server" Text="Button" /> </div> </form> </body> </html>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
teste.aspx.cs
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CascadingDropDown CustomValidator validatorcalloutextender
Developer
thiagosantos@thiagosantos.com.br
DarrellNorton
All-Star
78942 Points
8720 Posts
Moderator
MVP
Re: ValidatorCalloutExtender + CustomValidator - It´s possible?
Dec 18, 2006 12:53 AM|LINK
I believe, from looking at the ValidatorCallout known issues, that it only works on CustomValidators with client-side validation (i.e., JavaScript). Here's the part of the sentence:
"...will only work for custom validators which utilize client-side validation."
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
AndreBaltieri
Member
58 Points
14 Posts
Re: ValidatorCalloutExtender + CustomValidator - It´s possible?
Feb 05, 2007 06:11 PM|LINK
Can you show some exemple code??
I´m having this problem too.
[:(]
Tks...
See yaa!
André Baltieri
São Paulo - Brazil
http://www.insidedotnet.com.br/
Twitter: @andrebaltieri
==============================================
jmaag
Member
61 Points
22 Posts
Re: ValidatorCalloutExtender + CustomValidator - It´s possible?
Feb 21, 2007 07:58 PM|LINK
From what I've seen, you cannot use the ValidatorCalloutExtender when the CustomValidator is using a server side validation. In this case the solution is relatively simple. Instead of using a CustomValidator, try using a RegularExpressionValidator. I've tested the following at it will work with ValidatorCalloutExtender without a postback.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" Title="Untitled Page" StylesheetTheme="SkinFile" %> <!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 id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1" Display="None" ErrorMessage="weadsasdsa" ValidationExpression="janis" /> <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome" TargetControlID="RegularExpressionValidator1" runat="server" /> </div> </form> </body> </html>jmaag
Member
61 Points
22 Posts
Re: ValidatorCalloutExtender + CustomValidator - It´s possible?
Feb 21, 2007 08:13 PM|LINK
If you still want to use a CustomValidator, then create a ClientValidationFunction instead of a server side function. The following demonstrates an example of this.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" Title="Untitled Page" StylesheetTheme="SkinFile" %> <!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 id="Head1" runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function ClientValidate(source, clientside_arguments) { if (clientside_arguments.Value == "janis" ) { clientside_arguments.IsValid = true; } else { clientside_arguments.IsValid = false; } } </script> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="Error" ControlToValidate="TextBox1" ClientValidationFunction="ClientValidate" /> <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome" TargetControlID="CustomValidator1" runat="server" /> </div> </form> </body> </html>