Question : using required field validators to validate inputs for a textbox on an asp.net page

Hi.
I have an asp.net page with a couple of text boxes. I want to be able to add a project name  and add a client name independantly. there is a text box to enter a client name and then a button to submit that text, currently i have a required field validator so that an empty box cant be submitted, this was the only submission textbox and button on the page but now i need to add another textbox and submit button to add a project name.
My problem now is that i cant enter a project name without having some text in the client name box and vice versa. How do i get round this issue?

Many thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
asp page
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddProject.aspx.cs" Inherits="AddProject" %>
<%@ Register TagPrefix="Nav" TagName="Navigation" src="Navigation.ascx"%>
 

 


    Add Project
    


    

Clients Projects Site

Add projects page

 

Answer : using required field validators to validate inputs for a textbox on an asp.net page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddProject.aspx.cs" Inherits="AddProject" %>
<%@ Register TagPrefix="Nav" TagName="Navigation" src="Navigation.ascx"%>

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

http://www.w3.org/1999/xhtml">

   Add Project
   


   

   

       

           
>
                 

Clients Projects Site


                 

Add projects page


           

           


           

     

   
 
   
     

   

       
>
           

Select the client to add a project to from the list below


       

       

           

               
               
                       
                   

           

           

               

Click to view this clients list of contacts


             

             

                 

Click to add a Client


               

       

       
>
       

       
          ID="RequiredFieldValidatorproj" ControlToValidate="client" runat="server" ErrorMessage="Please select a client name" Display="Dynamic" />
         

       

       

           

               
               
           

           
   
                ControlToValidate="project" ValidationGroup="ProjectValidation" runat="server" ErrorMessage="Please provide a project name" Display="Dynamic" />
               
           

             
 
               
             

     

     

       

Click to view lists of projects


       

   

       

           
           
       

       

            ControlToValidate="NewClient" ValidationGroup="ClientValidation" runat="server" ErrorMessage="Please provide a Client name" Display="Dynamic" />
           
       

       

           
       

     

     

     

       
     
     

   

 


Random Solutions  
 
programming4us programming4us