Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have use RequiredFieldValidator with ValidatorCalloutExtender ajax control. Problem is that when validation is fired than error message of RequiredFieldValidator display along with message throw by ValidatorCalloutExtender ajax control. I want to display only error message throw by ValidatorCalloutExtender ajax control when validation done.
If you have idea abt it then give solution of it.Below i give tag for both controls.

XML
<asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ErrorMessage="Value Required!" Text="*" Display="None" ControlToValidate="TextBox1" ValidationGroup="Insert" ></asp:RequiredFieldValidator>

<ajax:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1" TargetControlID="RequiredFieldValidator1" Width="200px"
      PopupPosition="Right"/>
Posted

Try this:
ASP.NET
<asp:requiredfieldvalidator id="rfvStatus" runat="server" validationgroup="RO" controltovalidate="txtStatus" errormessage="Select the status." display="None" initialvalue="Select"/>
<cc1:validatorcalloutextender id="vceStatus"  runat="server" targetcontrolid="rfvStatus" popupposition="Right"></cc1:validatorcalloutextender>




--Amit
 
Share this answer
 
v2
Comments
NothingToLoose 13-Aug-12 2:39am    
when i added xmlns:asp="#unknown" tag in requiredfieldValidator & xmlns:cc1="#unknown" in ValidatorCalloutExtender then its generate error message like AjaxControlToolkit.ValidatorCalloutExtender' does not have a public property named 'xmlns:ajax'
_Amy 13-Aug-12 3:24am    
Try my updated answer. :)
NothingToLoose 13-Aug-12 4:11am    
Apply your suggested changes but when i click on button entire page is post back & following exception is generate when validation is fire
Unexpected Error: Cannot insert the value NULL into column 'Name', table 'tableName'; column does not allow nulls. INSERT fails. The statement has been terminated.
So its not feasible solution
_Amy 13-Aug-12 4:27am    
Put the same validation group i.e. validationgroup="RO" in your button also.
NothingToLoose 13-Aug-12 5:28am    
i have use same validation group name Insert both for button as well as RequiredFieldValidator still your suggested changes not work & page is postback & then throw above exception
Have a look on this links
LINK1
LINK2
 
Share this answer
 
You can do it by simply writing its Display Property to NONE. For REference you can see the code provided below..

<asp:textbox id="txtWebSite1" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator10" runat="server" controltovalidate="txtWebSite1" validationgroup="popup" display="None" errormessage="Website is Required." xmlns:asp="#unknown">
</asp:requiredfieldvalidator>


Here, you can see i have provided Display="None" so that it will not going to be displayed besides text box. but it will show in the <asp:validationsummary xmlns:asp="#unknown"> block.

Have a Nice DAY.....
 
Share this answer
 
Comments
NothingToLoose 13-Aug-12 3:03am    
As per your suggestion i have make changes in my tags just check below but still validation message of required field validator is display
<asp:TextBox ID="TextBox1" runat="server" MaxLength="50" xmlns:asp="#unknown">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Value Required!" Display="None"
ControlToValidate="TextBox1" ValidationGroup="Insert" xmlns:asp="#unknown" >

<ajax:ValidatorCalloutExtender runat="server" ID="ValidatorCalloutExtender1" TargetControlID="RequiredFieldValidator1" Width="200px"
PopupPosition="Right" xmlns:asp="#unknown"/>
Please check your browser setting. javascript code should be enabled.
 
Share this answer
 
Finally i have resolved this problem myself by adding
XML
<style type="text/css">
        .hideMessage{display:none;}
</style>

& set CssClass property of required field Validator

<asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ErrorMessage="Value Required!" Text="*" Display="None" ControlToValidate="TextBox1" ValidationGroup="Insert" CssClass="hideMessage"></asp:RequiredFieldValidator>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900