Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.Net 2.0 required field validator.

Reply
Thread Tools

ASP.Net 2.0 required field validator.

 
 
spidur1
Guest
Posts: n/a
 
      11-09-2005
For some reason these fields are not being validated before the
postback. Here the HTML page. Am I missing something from the
validator controls that needs to be set?


<table cellpadding="0" cellspacing="0" style="padding-top:0;
padding-bottom:0; padding-left:0; padding-right:0;" width="800">
<tr style=" background-color : #5D7B9D;">
<td colspan="2">
<asp:Label ID="Label5" runat="server"
Font-Size="Large" ForeColor="White" Text="Insert New Premium
Multiplier"
Width="432px"></asp:Label></td>
</tr>
<tr>
<td style=" width: 400px;">
<asp:Label ID="Label3" runat="server"
Font-Bold="True" Text="Description" Width="200px"></asp:Label></td>
<td style=" width: 400px;">
<asp:Label ID="Label4" runat="server"
Font-Bold="True" Text="Multi" Width="296px"></asp:Label>
</td>

</tr>
<tr>
<td style=" width: 400px; vertical-align:top;">
<asp:TextBox ID="txtDescriptionMain" runat="server"
Width="350px"></asp:TextBox><br />
<asp:RequiredFieldValidator
ID="RequiredFieldValidatorD" runat="server"
ControlToValidate="txtDescriptionMain"
ErrorMessage="Description is Required"
Display="Dynamic" ValidationGroup="Insert"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
<td style=" width: 400px; vertical-align:top;">
<asp:TextBox ID="txtMultiMain"
runat="server"></asp:TextBox><br />
<asp:RequiredFieldValidator
ID="RequiredFieldValidatorX" runat="server"
ControlToValidate="txtMultiMain" ErrorMessage="Please Supply a Premium
Multiplier" ValidationGroup="Insert"
Display="Dynamic"></asp:RequiredFieldValidator>
<asp:CompareValidator
ID="CompareValidatorX" runat="server" ControlToValidate="txtMultiMain"
ErrorMessage="Please Supply a Valid Integer" Operator="DataTypeCheck"
Type="Integer" ValidationGroup="Insert"
Display="Dynamic"></asp:CompareValidator>

</td>
</tr>
<tr>
<td style=" width: 400px; height: 35px;
vertical-align:bottom;">
<asp:LinkButton ID="LinkButton3" runat="server"
ValidationGroup="Insert">Insert Record</asp:LinkButton></td>
<td style=" width: 400px;">
</td>

</tr>
</table>

 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      11-09-2005
you forget to include a ValidationSummary control, so there is no way to
display a validation error.

-- bruce (sqlwork.com)

"spidur1" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> For some reason these fields are not being validated before the
> postback. Here the HTML page. Am I missing something from the
> validator controls that needs to be set?
>
>
> <table cellpadding="0" cellspacing="0" style="padding-top:0;
> padding-bottom:0; padding-left:0; padding-right:0;" width="800">
> <tr style=" background-color : #5D7B9D;">
> <td colspan="2">
> <asp:Label ID="Label5" runat="server"
> Font-Size="Large" ForeColor="White" Text="Insert New Premium
> Multiplier"
> Width="432px"></asp:Label></td>
> </tr>
> <tr>
> <td style=" width: 400px;">
> <asp:Label ID="Label3" runat="server"
> Font-Bold="True" Text="Description" Width="200px"></asp:Label></td>
> <td style=" width: 400px;">
> <asp:Label ID="Label4" runat="server"
> Font-Bold="True" Text="Multi" Width="296px"></asp:Label>
> </td>
>
> </tr>
> <tr>
> <td style=" width: 400px; vertical-align:top;">
> <asp:TextBox ID="txtDescriptionMain" runat="server"
> Width="350px"></asp:TextBox><br />
> <asp:RequiredFieldValidator
> ID="RequiredFieldValidatorD" runat="server"
> ControlToValidate="txtDescriptionMain"
> ErrorMessage="Description is Required"
> Display="Dynamic" ValidationGroup="Insert"
> SetFocusOnError="True"></asp:RequiredFieldValidator>
> </td>
> <td style=" width: 400px; vertical-align:top;">
> <asp:TextBox ID="txtMultiMain"
> runat="server"></asp:TextBox><br />
> <asp:RequiredFieldValidator
> ID="RequiredFieldValidatorX" runat="server"
> ControlToValidate="txtMultiMain" ErrorMessage="Please Supply a Premium
> Multiplier" ValidationGroup="Insert"
> Display="Dynamic"></asp:RequiredFieldValidator>
> <asp:CompareValidator
> ID="CompareValidatorX" runat="server" ControlToValidate="txtMultiMain"
> ErrorMessage="Please Supply a Valid Integer" Operator="DataTypeCheck"
> Type="Integer" ValidationGroup="Insert"
> Display="Dynamic"></asp:CompareValidator>
>
> </td>
> </tr>
> <tr>
> <td style=" width: 400px; height: 35px;
> vertical-align:bottom;">
> <asp:LinkButton ID="LinkButton3" runat="server"
> ValidationGroup="Insert">Insert Record</asp:LinkButton></td>
> <td style=" width: 400px;">
> </td>
>
> </tr>
> </table>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Create a VD with required properties on a required Web Server (Windows Advanced Server 2000 has 3 Web Servers) Just D. ASP .Net 0 03-10-2006 06:02 AM
Required Field Validator Client side popup Jinsong Liu ASP .Net 3 08-14-2003 07:53 PM
Netscape required field validation problems Rick ASP .Net 3 07-07-2003 09:37 PM



Advertisments