Web Forms :: Validate TextBox When It Has Date And Not When Empty?
Mar 26, 2016
i have a problem in validations. in my query
DateTime dateformat;
if (DateTime.TryParseExact(TxtDate.Text, "dd-MMM-yyyy", null, DateTimeStyles.None, out dateformat) == false)
{
lblErrMsg.Text = "Enter valid Txtdate";
return;
}
by using above query i am alert the if date entry format wrong. it is working fine but when ever if user not enter any date in TxtDate.Text then no need to alert just save datetime.minvalue. how to do it.
I am having one form in which payment mode have 2 radiobuttons cash and cheque when cash is there cheque panel remains in visible and when cheque is clicked panel opens in that there is cheuqe no,date and bank name.
my problem is that when i store cash data the cheque date by default stores date 1-jan-1900
I would like to validate the textbox for specific text and it must not be blank. But the regular expression validator is not validating if the text box is BLANK. However, it validates if I type something in the text box.
How can I make regular expression to trigger even if the text box is empty?
Should I use Required Validator + Regex Validator at the same time?
i have a calendar control whose value will be displayed in a textbox, i need to validate the textbox value to the current date... It should not be less than current date.....
I aam working with textChanged event in a textbox to validate a value in textbox.hen i am enter data in textbox then press submit button i am getting validation summary before the textbox textchanged event. Is there anyway to fire textchanged event first to validate before button validation summary?
I need to validate a date in a web forms application. For this I use a CompareValidator with
Operator="DataTypeCheck" Type="Date"
The problem is that this Validator doesn't work properly on Firefox with 2 digit years. ( javascript error: m[2] is undefined)With a 4 digits year it's working properly.
This problem is described also here:[URL]two-digit-year-in-mozilla-based-browsers-throws-js-exception
i have two controls in one page, grid control and a form control, inside the grid control there is a textbox control. my question is when ever click update in the gridcontrol, the validation control in the form control get fired and the page does not post to the server.
I have a text field set up to accept a date: [Code]....
how to get the validator to make sure that the YEAR is acceptable. For instance, I can enter a year of "0000" and the validator will not catch it or display the error message. I can even enter a year of "9999" also. The only time the validator catches it is if I input something like "45/95/7589" for the date.
I have a about 6 or 7 text boxes which needs to be validated to make sure they are not empty from server side code. So how I usually do this is, check each textbox 1 by 1 to ensure that they are not empty. Are there any other efficient methods to do this? I have searched on SO and have found out that adding all the textboxes to a list and using a for each is a much better method. Are there any other ways that this can be achieved? Thanx a lot in advance :)
I want to check that a user has not entered a date for the from date that is later than the to date and vice versa. Because it gives me an out of range query error if it is!
In my website their is a textbox for adding birth date...
I am using the ajax calendar for selecting date...
I want that the user who enters the date shld be above 16yrs old...
Means i want that the date should be minus from the current date and should be calculated as 16yrs or above it...
For example:- user 'A' selects a date 5th may 2005 and the current date is 28th march 2013 (which means that the age is 8 yrs)... than it should show an error that "your age should be above 16 yrs"...
if txtQuantity is a positive Number I must enter something in txtDesc
So
I can't submit the form without entering txtDesc if txtQuantity is positive/decimal number & No need to enter anything in txtDesc if the txtQuantity is 0/null/empty/space/spaces/blank How?