In most of the case after inserting data into database or carrying out any other transactions. Here is the ready made function : Step 1: /// /// Pankaj lalwani /// Reset all textbox/radiobutton/dropdowns/listbox /// /// public static void Clear Fields(Control Collection page Controls) Step 2: Call this method on submit/save click after your code ends or sometimes when you provide clear/reset button to empty all fields Clear Fields(Form.
Now enter the invalid Email Id, it will show the following message: Now enter the word that does not match the confirm word, it will show the following message: Now enter the valid details.
Now click on the "Create" button; it will redirect to the next page as in the following: Note For detailed code please download the zip file attached above.
Basically what it's saying is that validation will succeed if any other value than the 1 set in Initial Value is selected in the dropdownlist.
I have a Required Field Validator on a dropdownlist, and when I initially populate the list and submit the form, without changing the values it doesn't prompt me with the validation message, however, after the postback, if I try and submit the page again, without changing the dropdownlist - it does show me the validation message!! I hope i have understood ur question if not please correct me Just replace your ddl and Required Field Validator with these ones and see if you are getting the same problem.
Importantance of returning false It's very important to use the return false statement after the condition block that return false so if validation determines that the business requirements are not met then the form cannot be submitted.
If you do not return false then the message will be displayed to the user that all fields are required but the form will be post back and it gives you the second page directly. The condition that checks both text boxes for word are as in the following: In the preceding condition, first we ensure that the email id is not blank then we match the email id entered into the text box to the Regular Expression that is saved in the email Exp variable.
When you say you use forms to do the interactiviy, what if your form contains data from a database?
Do you write code to do the same thing that Crystal does (i.e. In the contents frame (left panel) I have a listbox that lists the reports. When the user selects a report it exports it to a pdf file and displays it in the main frame (or could display it on the Crystal Viewer).
Sorry, I am not familiar with what you are trying to do since I tend to use forms to handle interactivity.
I did find some info in Crystal Help that might be helpfull - Do a seach for Hyperlink Fields and Parameter Fields.
Now add the condition to ensure that all controls have a value, if the values are not entered in the form control then it will show a message.