Web Forms :: Trying To Create A Custom Control That Has A Dropdown List And A Required Field Validator In It?
Jan 19, 2011
I'm trying to create a custom control that has a dropdown list and a required field validator in it.I've got as a far as being able to set the error message if the control fails to validate, but I can't actually get it to validate, not can I figure out how to call a .Validate method server side. This is driving me nuts!
To create my control, I followed the article here I ran the text box example through, and I can get that to validate without any problems, so I then went through and created a new set of class files relating to a drop down list.Anyone got any thoughts, or hints as to what might be wrong, or where I should start looking?
I have an aspx page which has 18 (yes 18) dropdown lists and 18 text boxes. Each dropdown needs to be selected and each textbox needs to be filled. Dragging and dropping required field validators on these 36 controls and maintaining them is a painful task and does not seem to be the logical option as all I need is for the user to select a value from the dropdown.
Is there anyway I can loop through all these dropdown controls and textbox controls, check if they are empty and display warnings to users accordingly? Client-side validation solution or server side validation solution is fine with me.
I have a page where in there are various entry fields like name, registration number, country, state etc whcih are mandatory. On selection of country in dropdown,the state dropdown is filled and in the phone number boxes the country code is also filled simultaneously.
When I click on Save button it shows the required fields respective messages in the validation summary. When I select the country the state and country code are filled and the validation summary vanishes though I have not entered text in the other mandatory fields. None of the required fields messages are displayed though all fields except Country state and country code are filled.
I am trying to get the required field validator to work. I have given it an initial value of the first index value in the dropdown list. I is just not working. Will my contrrols residing on a View of a Multiview control effect anything. I am using all drop down lists?
When it comes to field validation, when I use a Compare Validator to make sure a date is a date or a numeric field has a number, I must also use a Required Field Validator to make sure there is something actually enetered. In other words, the Compare Validator allows a blank value even though a blank is not a date or number or whatever.
Is using both a Required Field Validator and a Compare Validator the way to do this or is there some way to make the Compare Validator also require input of some kind?
I have a form that contains times and dates. Each of these controls has a required field validator so that the user must put in the date and time. This apprears to work fine in testing. The data is stored in sql tables which are then worked with in the office using an Access Database. The webforms are simply used for gathering the data. In analyzing the data, they are finding that there are instances when no time has been stored. I don't know how the insert information could be saved if the control was blank. To make matters worse, the staff swear that they are entering the times.
Sometimes while registering on the website people don't provide correct details like name and e-mailIn order to check correct e-mail it is better to use e-mail activation link send to their e-mail.But how to make sure the user is providing correct name ?I am really impressed by the Facebook name recognition system, it we try to use any word which is not a name, it asks you to enter a valid name.Is there any way we can make use of asp.net requiredfieldvalidator to check if user is providing a correct name or not ?I know we can make use of requiredfieldvalidator to see how many alphabets / special symbols etc butIf we put minimum alphabet requirement - in that case user can enter "....." and can easily bypass the requiredfieldvalidator or a user can easily write "iamfakeuser" instead of name and bypass the requiredfieldvalidator. question is how to check if name is correct or not just like facebook registration form ?
I'm trying to use a field validator to make sure one of my list boxes has a selection before the user is able to proceed to the next page. i'm having is that if the validation message is triggered, all of the buttons on my page loose functionality.Meaning, if I purposely trigger the validation control, I can't get rid of the error message and none of my buttons do anything when clicke after this.
The majority of the HTML:
Is there something that I need to add to the code behind of the page or the Java Script that I'm using?
Interested in a way to call an event when the Required Field Validator component determines the assigned text field is not valid/empty. Is this possible? Somewhat surprised it doesn't have an event for this. Am I missing something?
I need to add a Required Field Validator to a text box on my page. When I add the validator the following happens when I run the page:
When I click the submit button the page doesn't submit because the page is invalid. No error message displays despite my having set the ErronMessage. When I click inside the text box that has the Validation, then the Required error message shows. When that textbox loses focus the error message goes away. The only way I can get the page to function correctly is if I create 2 Validators for the same text box. The first validator is set to have an ErrorMessage of "" and the second one is a regular error message.
I have used these before many upon many times and never experienced this. Below you will find the Source code.
This code is the only way I am able to get the validation to function correctly where the ErrorMessage displays when I leave the field blank. I appreciate any help on resolving this issue. I have deleted/re-added the validation control many times. This is the only page this type of error happens on.
I have a web forms where i have 10 required field validators for 10 textboxes. Validation group for these required field validator needs to be determined when the page loads. I tried to change the validator in the .cs file but failed.
I have a table that has 3 fields (Individual-Id, LastName, and FirstName). I want to create a drop down table that displays both the FirstName and the LastName (example: Smith, John). The field Individual-Id is the 'value' field.
i am working on web-form for which I have set the validation summary showmessagebox = "true".
I have two required field validators, which trigger on a checkbox's OnCheckedChanged event....now my problem is, when I hit submit, the page does not submit if I do not enter any values in the text boxes..which is correct behavior but it does not point out to the error or does not display the message box.
i have to scroll up to see what is wrong with he page and then try to enter the values...I do not understand why my message box does not show up or at least why my setfocusonerror which is set to true does
I have a gridview that contains a textbox, a drop down, and a checkbox. The commandfield of the gridview has ShowEditButton="true". All of the gridview updating takes place in the "_OnRowUpdating" event. I have a Panel above the gridview with a table and some fields. Everything in the gridview works perfectly, the edit, the update etc., however, when I add a requiredfieldvalidator to the panel above the gridview, the gridview update functionality no longer works. e.g., clicking the update button does not appear to fire. If I comment out the requiredfieldvalidator, everything works fine.