You have to make user to enter just integer values with TextBox. Can you do this with CompareValidator?

 Posted by Bhakti on 11/16/2009 | Category: C# Interview questions | Views: 2740

Yes. With the validator control, you need to set type attribute to the desired datatype which in this case is “Integer” and Operator to DataTypeCheck.

<asp:CompareValidator ID="CompareValidator1" ControlToValidate="TextBox1" Type="Integer" Operator="DataTypeCheck"

runat="server" ErrorMessage="CompareValidator"></asp:CompareValidator>

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response