G
Guest
I created a server control that inherits from WebControl that has the
following property:
private Object _Value;
public Object Value {
get { return _Value; }
set { _Value = value; }
}
I want to be able to set this property on the aspx as follows:
<my:Control ID="TestControl" Value="SomeValue" runat="server" />
However, I get the following error:
Cannot create an object of type 'System.Object' from its string
representation 'SomeValue' for the 'Value' property.
I have tried going the TypeConverter route and have got it to work with
other types, but I can't seem to get it to work with the plain old object. I
have been able to work around this problem by adding another property called
ValueString, but I would really rather not go that route. What I really want
is for the aspx to just pass its string to my System.Object since that
conversion should be implicit.
Has anyone gotten this to work for System.Object properties.
following property:
private Object _Value;
public Object Value {
get { return _Value; }
set { _Value = value; }
}
I want to be able to set this property on the aspx as follows:
<my:Control ID="TestControl" Value="SomeValue" runat="server" />
However, I get the following error:
Cannot create an object of type 'System.Object' from its string
representation 'SomeValue' for the 'Value' property.
I have tried going the TypeConverter route and have got it to work with
other types, but I can't seem to get it to work with the plain old object. I
have been able to work around this problem by adding another property called
ValueString, but I would really rather not go that route. What I really want
is for the aspx to just pass its string to my System.Object since that
conversion should be implicit.
Has anyone gotten this to work for System.Object properties.