K
Konstantin
Hi!
I have a strange problem with custom control data binding.
I have created a new web control that has a couple of properties of type
Decimal. Everything works fine if I bind these properties to something of
type Decimal, but if I try to bind them to, say, Int or Short, I get
"Specified cast is not valid" exception.
That is a bit funny, this web control is read-only, i.e. it does not trying
to modify anything. Both, int and short types can be converted to decimal. I
even tried to attach a standard type converter and my own type converter to
these properties. No luck.
Any help would be really appreciated.
BTW, I tried to change these properties to be int, short, single etc. The
same problem.
Here is some pseudocode:
[Bindable(true),
Category("Data"),
DefaultValue(typeof(Decimal), "100")]
public Decimal Maximum
{
get
{
return maxValue;
}
set
{
maxValue = value;
}
}
I have a strange problem with custom control data binding.
I have created a new web control that has a couple of properties of type
Decimal. Everything works fine if I bind these properties to something of
type Decimal, but if I try to bind them to, say, Int or Short, I get
"Specified cast is not valid" exception.
That is a bit funny, this web control is read-only, i.e. it does not trying
to modify anything. Both, int and short types can be converted to decimal. I
even tried to attach a standard type converter and my own type converter to
these properties. No luck.
Any help would be really appreciated.
BTW, I tried to change these properties to be int, short, single etc. The
same problem.
Here is some pseudocode:
[Bindable(true),
Category("Data"),
DefaultValue(typeof(Decimal), "100")]
public Decimal Maximum
{
get
{
return maxValue;
}
set
{
maxValue = value;
}
}