Give any one of the below query to use Currency (Price) Validation ..
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
function
checkDecimals(fieldName, fieldValue) {
decallowed = 2;
if
(isNaN(fieldValue) || fieldValue == "")
{
fieldName.select();
fieldName.focus();
}
else
{
if
(fieldValue.indexOf('.') == -1) fieldValue +=
".";
dectext =
fieldValue.substring(fieldValue.indexOf('.')
+ 1, fieldValue.length);
if
(dectext.length > decallowed) {
fieldName.select();
fieldName.focus();
}
else
{
}
}
}
</script>
<input id="txtbox" type="text" name="txt" onkeypress="checkDecimals(this.form.txt,
this.form.txt.value)">
OR
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="ariy.validator.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function
() {
$('#quantity').ariyValidate({
type: "price",
error_message: "Raja"
});
});
<input type="text" id="quantity" />
OR
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="rev_CashTextBox" runat="server"
ValidationExpression="^\$?\-?([1-9]{1}[0-
9]{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\-?\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\(\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))\)$" ControlToValidate="TextBox1"ValidationGroup="vld_Edit"
ErrorMessage="*" ForeColor="Red"
Display="Dynamic"
ToolTip=""/>
<asp:Button ID="Button1" runat="server" Text="Button"
ValidationGroup="vld_Edit" onclick="Button1_Click" />
No comments:
Post a Comment