开发者

Gridview text box edit

开发者 https://www.devze.com 2023-01-13 10:02 出处:网络
I have a textbox inside the gridview. IF i en开发者_StackOverflowter any non-numeric values it has to show error message. How to handle this in row edit eventYou need a RegularExpressionValidator to c

I have a textbox inside the gridview. IF i en开发者_StackOverflowter any non-numeric values it has to show error message. How to handle this in row edit event


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消