Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am using gridview in vb.net windows applications.in the grid view first two cells are string value and the 3rd cell we have to enter decimal values.please someone help me to validate like not allow to press follwing keys a-z[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$.and only allow to press integer and ".".
Posted

use template column in grid

and have a regular experssion like below

XML
<asp:RegularExpressionValidator ID="REVtxtDecimal" runat="server"
                                                                            ControlToValidate="txtDecimal" ErrorMessage="decimal Value-Enter only numerics.Format like (x.xx)"
                                                                            Text="*" ValidationExpression="^\d+(\.\d\d)?$" Width="1px"></asp:RegularExpressionValidator>
 
Share this answer
 
Thank you for your question,

You can use DataFormatString property.

XML
<asp:Boundfield DataField="Price" HeaderText="Price" SortExpression="Price" DataFormatString="{0:n3}"/> 


You can follow the bellow simple:

http://msdn.microsoft.com/en-us/library/ms993231.aspx[^]

Thanks,
Mamun
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900