G
Guest
The following works...
<asp:CompareValidator
Runat="server"
ControlToValidate="txtValue"
Text="*"
ErrorMessage="The value you provided is not of the correct type."
Operator="DataTypeCheck"
Type='Double'
/>
.... and the following doesn't ...
<asp:CompareValidator
Runat="server"
ControlToValidate="txtValue"
Text="*"
ErrorMessage="The value you provided is not of the correct type."
Operator="DataTypeCheck"
Type='<%# DataBinder.Eval(Container.DataItem,"ASPType") %>'
/>
.... even though I have checked that DataBinder.Eval(Container. DataItem ,
"ASPType") is evaluating to the string value "Double".
The error is pretty cryptic. Here's a part of the trace...
FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value,
NumberFormatInfo NumberFormat)
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value)
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
[InvalidCastException: Cast from string "Double" to type 'Integer' is not
valid.]
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
Microsoft.VisualBasic.CompilerServices.IntegerType.FromObject(Object Value)
Can anyone help me understand what I'm doing wrong?
Thanks!
Keith Spitz
Wall Street on Demand, Inc.
<asp:CompareValidator
Runat="server"
ControlToValidate="txtValue"
Text="*"
ErrorMessage="The value you provided is not of the correct type."
Operator="DataTypeCheck"
Type='Double'
/>
.... and the following doesn't ...
<asp:CompareValidator
Runat="server"
ControlToValidate="txtValue"
Text="*"
ErrorMessage="The value you provided is not of the correct type."
Operator="DataTypeCheck"
Type='<%# DataBinder.Eval(Container.DataItem,"ASPType") %>'
/>
.... even though I have checked that DataBinder.Eval(Container. DataItem ,
"ASPType") is evaluating to the string value "Double".
The error is pretty cryptic. Here's a part of the trace...
FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value,
NumberFormatInfo NumberFormat)
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value)
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
[InvalidCastException: Cast from string "Double" to type 'Integer' is not
valid.]
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
Microsoft.VisualBasic.CompilerServices.IntegerType.FromObject(Object Value)
Can anyone help me understand what I'm doing wrong?
Thanks!
Keith Spitz
Wall Street on Demand, Inc.