By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,830 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,830 IT Pros & Developers. It's quick & easy.

ASP.Net 2.0 required field validator.

P: n/a
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>

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
you forget to include a ValidationSummary control, so there is no way to
display a validation error.

-- bruce (sqlwork.com)

"spidur1" <sp*****@excite.com> wrote in message
news:11**********************@f14g2000cwb.googlegr 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>

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.