Reputation: 1476
I have a textbox inside the gridview. IF i enter any non-numeric values it has to show error message. How to handle this in row edit event
Upvotes: 2
Views: 650
Reputation: 460028
You need a RegularExpressionValidator to check for numeric value.
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Enter only Numbers" ValidationExpression="[0-9]*"></asp:RegularExpressionValidator>
Don't forget to add a RequiredFieldValidator too, if empty Text is also invalid.
Upvotes: 1