ASP. NET Workshop Assignment 2

Document Sample
ASP. NET Workshop Assignment 2 Powered By Docstoc
					               ASP.NET Workshop                                     Database Management Course

                                       ASP.NET Workshop

                                                Assignment 2
                                        Submission date:30.4.2007


1. There exist a TextBox named tbName and you want to know if its “Rina”. Does the following
   validation solve the problem? Explain!
   <asp:CompareValidator runat="server"
   ControToValidate = "tbName"
   ControlToCompare = "Rina"
   ErrorMessage = "The value is not Rina" />

2. Which control should be used to validate:
   • A password which is entered twice for confirmation
    •   The age of the user to be over 21
    •   The date to be after the 10/10/2000

Justify your answer by writing correct Validators and conditions.

3. What are the meaning of the following regular expressions?
   • Rina.*@.*\..*\.il
   •    (ba){3,}
   •    ^[A-Za-z]+$
   •    [0-5]?0+$

4. Write a regular expression that
   • checks if the given input has a sequence 123 at the end of line.
    •   checks if the given input is a correct URL address of ftp site and the requested file name is
    •   checks if a given input is a .html file that starts with underscore and has only Latin letters in its

              ASP.NET Workshop                                 Database Management Course

5. Write the following application.
The initial page is called Validator.aspx and it has 7 text boxes representing (Name, Family Name, Address,
City, Zip Code, Phone and e-mail address) and a Check button.

User gets the following page after clicking on Check button:

The required validation actions are:
• name different from family name,
• address at least 2 letters,
• city at least 2 letters,

              ASP.NET Workshop                                   Database Management Course

•   zip-code 5 digits,
•   phone according to the format XX-XXXXXXX or XXX-XXXXXXX,
•   e-mail is a valid email.

After entering some of the details correctly user gets the following message:

               ASP.NET Workshop                               Database Management Course

And after a correct submission of all the details:

Submission instructions:
You should submit the following:
1. A printed version of code-behind C# code ( a .cs file) to Hadar Avodot.
2. A softcopy of the files Validator.aspx and Validator.aspx.cs to the following email address Pls. Send only 2 required files and not the whole project.
      • If one of the things mentioned above is missing – your assignment will get a 0 mark.