.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net


I have create user wizard control and i put validation control for all field but when i close user control that validators dint clear in firefox or but clear in IE


May i know solution for this>? 

View Complete Post

More Related Resource Links

Field validators does not work when field is manipulated with ajax

Hi.I have defined a field validator that works fine on normal behavior on a page:<asp:RequiredFieldValidator runat="server" ErrorMessage="errroooorr"  ControlToValidate="TextBoxHouseNumber" Display="Dynamic"></asp:RequiredFieldValidator>Now if I dont insert any text in the TextBoxHouseNumber field, and push submit, the FieldValidator fires as it should. But if I now click a button that automatically fills the TextBoxHouseNumber with text from a Jquery/Ajax function, the field validator still shows. It´s like "Hey, the user hasnt made any changes to the textbox, so I wont bother check it".How can I overcome this problem?Thanks alot! :)

Validators, but for "warnings" not "errors"

Folks, I have made extensive use of the standard .NET Validators - preventing submission of a page if (for example) the Date of Birth indicates that an individual is under 21 years of age.  The Validators are configured to display an error icon next to the field and obviously they fire when focus is lost and/or when the user tries to submit the form. I'm now investigating a similar requirement, but for warnings.  So, again for example, the Date of Birth indicates that the an individual is over 80 years old (unusual, but not impossible).  Here I want a different icon to appear when the user tabs away, and for a confirm popup (along the lines "of there are warnings, are you sure?) when the user submits the form. Some of the pieces already exist (such as the Ajax Control Toolkit Confirm Button). What I'm hoping for is a pointer towards the best way to handle the "under the covers" processing - things like collecting the "warning validators" together and firing them when submit is pressed - essentially a very close parallel to what the existing Validators do.  I don't need the complexity of being able to repeat the checking server-side -- there is no point in warning the user for a second time and, if they bypass the client side checks for some reason, so what! I guess then it's some Javascri

DropDownList Validators Not Validating

I can't seem to get any sort of validator to fire when validating my DropDownList.  I just want to make sure that it isn't left at "--Select--" when the user presses the Add button on the page.  I've tried a range validator and required field validator and neither seem to fire at all.  My DropDownList contains ID which is an int that is hidden and Name which is a string that is displayed.  The ID is -1 for "--Select--".I use these all the time and can't understand why the page in this new solution is any different from other solutions I have done in the past.  What have I missed?<asp:DropDownList ID="drpProducts" runat="server" CausesValidation="True" ValidationGroup="AddExistingProduct"></asp:DropDownList> <asp:Button ID="btnAddExistingProduct" runat="server" Text="Add" onclick="btnAddExistingProduct_Click" ValidationGroup="AddExistingProduct" CausesValidation="true" /> <asp:RequiredFieldValidator ID="rfvAddExistingProduct" runat="server" Enabled="true" ValidationGroup="AddExistingProduct" ControlToValidate="drpProducts" InitialValue="-1" ErrorMessage="*"></asp:RequiredFieldValidator> <asp:RangeValidator ID="

Taming Multiple Validators on Dates

I have a text box for input of a date.  It has three validators: Required Field - to make sure it's completed Compare - setup to check the data type Compare - setup to check against a limit The second two, as expected, do not fire if the field is empty. If the user keys a stupid date, such as 01/19/0010 the second validator fires as expected.  However, the third validator also fires because the "date" is earlier than the specified limit. Is there any way to prevent the third validator firing, if the second validator has fired (ie once one validator has fired on a particular control, no more validators on that control will fire)? If not, then I guess I'm either going to need to write my own third validator which ignores invalid dates, just like it will ignore an empty field (assuming that the second validator will always be there to take care of invalid formats); or again my own validator but effectively combining the checks of validators two and three (ie checking for format first and then against the limits). I can't be the first person to try and do this.  Anyone?

ModalPopup, Validators and Client Button Click


Hi All,

I have a modal popup containing a text box and a required field validator.

If I click on the OK button with no value specified, it closes the popup after briefly showing the required field validator's error text.

I've seen some posts about how to get validators working with modal popups by not setting the OKButton property, but the trouble is I need  to have both the validator and a  button click (this is where I save the data)

Can anyone help?


field validators



I want to ask how I can be sure that one of two textboxes contains data when click the button ,,,,

am using RequiredFieldValidator as bellow

<asp:TextBox ID=TextBox1 runat=server Width=150px></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox1">
<asp:TextBox ID=TextBox2 runat=server Width=150px></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox2">

and for button

<asp:Button ID=Button1 runat=server Text="SendMail" CausesValidation=true Width=70px OnClick="Button1_Click" />




all validators programatically executed when page is loaded


Can i run all validators when page is loaded. I need to show * in all input text fields that are necessary. I have require field validators for that fields, can i run it by default when page is loaded?

Problem validating StringBuilder fields in SharePoint 2010 Custom Workflow Validators


One of our custom SharePoint Designer workflow activities, which have always worked fine in SharePoint 2007, fails to validate.

This appears to happen when a Workflow Activity that contains a StringBuilder field also contains a lookup variable.

<FieldBind Field="CustomCode" Text="this code" Id="1" DesignerType="StringBuilder" />

For example when we store the following in this StringBuilder field

"Today's date = [%Current Item:Transaction Date%]"

This field returns 'null' in the ActivityValidator. As a result we cannot validate its contents.


GridView: Hide validators and show validator summary


Hi, I want to have TextBox validators like in this case: http://msdn.microsoft.com/en-us/library/ms972948.gridview_fig45l(l=en-us).gif

I transfer the code to my necessities but the error message, displayed at the textbox, is the same as in the summary.

In the msdn - example there is only a asterisk at the respective textbox where the validation fails and the full error message is displayed in the summary.

How can I handle this? It seems to me that the validation summary only repeat the single error messages of the validators. When I set the single validators vissibility to "hidden"(which I would also use, because I thought they are still displayed in the validation summary -_- ), they are not displayed in the summary too.


Page.Validators property


Hello ,

I have the following problem:

Here is the server side code :

 void Page_PreRender()
            foreach (RequiredFieldValidator valcontrol in Page.Validators)
                WebControl assControl = (WebControl)Page.FindControl(valcontrol.ControlToValidate);
                if (!valcontrol.IsValid)
                    assControl.BackColor = System.Drawing.Color.Gray;
                    assControl.BackColor = System.Drawing.Color.Violet;

in the client side code I have three Requiredfieldvalidators.I will write the code for one of them in order to give you an idea:

ControlToValidate="txtagrilevel" />

When i run the page,I get the following error pointed on the line:

 assControl.BackColor = System.Drawing.Color.Violet;
The error message is :

Object reference not set to an instance of an object.

I would appre

how to set up different validation summary for different type of validators


Hi guys,

what i want to do is to  set up different validation summary for different type of validators. for example, for required field validators, if user leaves some required field blank, it shows that "You have to fill in mandantory information, indicated with a star"

and if some format is wrong, it shows that "format is invalid"

right now, i set all requied field validators' text to be a star, and leave error message to be blank. so that the validation summart will only display the header message. that is what i need. what i dont know is how to separate regular expression into another summary.

i think the validation group property requires multiple buttons. however, i only want one submit button, and this is where i got stuck.


any help is appreciated! Thanks in advance.


Are validators also checked server-side?


Are RequiredFieldValidators and RegularExpressionValidator also checked automatically server side?

Thank you!

set off to requiredfield validators in tabs



i created 2 user controls and called them in two different tab panels.
each user control has few requiredfield validators.
aspx has one updatepanel and that updatepanel holds tabcontainer.
each tabpanel of above tabcontainer holds one user control and a button, so there are 2 tab panels to hold 2 user controls and 2 buttons.

                <uc1/> <bt1/>
               <uc2> <bt2/>

suppose i dont enter required fields in uc2 and navigated to tp1 n filled all the required fields of uc1 and clicked on bt1.
here bt1 click event is not firing as requiredfield validators of uc2 are not passed.

how do i make this work?
requiredfield validators shud fire for that respective tab usercontrol only not for all the usercontrols.
any other approach u know?
plz guide me, i got stuck up here.

ASP.NET : Validators On AJAX : ModalPopUp


Hi Experts,

How to disabled validators?

My problem is that, I have Page1.aspx and Page2.aspx.

On both the page, I have asp:RequiredFieldValidator with ModalPopUp.

Suppose, when I hit the Submit button on Page1 then Validators call's up.

Same time, when I go to the Page2, and hit Submit button then nothing is going to happens. This is because of still the Validators on Page1 need required value on the back ground.

So my plan is to disabled the validators of that specific page on Close button (it may be client or Sever side) of that page.

How to do it? Or any other alternate is there?


Dynamically positioning my Validators


I am using a Textbox with CalendarExtender(AJAX) for displaying date.Now I have set two Validations over this control.

One COMPAREVALIDATOR for comparing date (input date should not be greater than present date)

Other REQUIREDFIELDVALIDATOR so that user doesnot enter empty text.

I have placed them on right side of my datetime control. First COMPAREVALIDATOR and then REQUIREDFIELDVALIDATOR.

The problem I am facing is that when User enters/empties the datetime control(forcefully by deleting) the REQUIREDFIELDVALIDATOR becomes visible at its place but at a distance from the CONTROL which doesn't look good (the space occupied by COMPAREVALIDATOR is still intact though its not visible)

How can I manage my two validators so that they are visible at same place(whenever they are called) just next to CONTROL , rather than at the place I kept them.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend