Which control markup should you use?

You are implementing an ASP.NET page that includes a text box.
You need to validate values that are typed by users to ensure that only numeric values are submitted.
Which control markup should you use?

You are implementing an ASP.NET page that includes a text box.
You need to validate values that are typed by users to ensure that only numeric values are submitted.
Which control markup should you use?

A.
<asp:TextBox ID=”txt1″ runat=”server” CausesValidation=”true” ValidationGroup=”Numeric” />

B.
<asp:TextBox ID=”txt1″ runat=”server” EnableClientScript=”true” ValidationGroup=”Numeric” />

C.
<asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″ runat=”server” ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />

D.
<asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″ EnableClientScript=”true” ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />



Leave a Reply 0

Your email address will not be published. Required fields are marked *