Custom web control data binding (Non-string properties)

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;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top