clearing properties of type int

J

Jeremy Chapman

I was looking at the HtmlTable control, and noticed that the CellPadding and
CellSpacing properties are of type integer, yet in the property grid you can
clear the values. I'm trying to make a property of type int in one of my
controls and when I clear the property in the design time property editor, I
get an error "Property value is not valid." Using reflector I took a look
at the code inside the HtmlTable control and I've pretty much copied it in
my control but it still doesn't work. Has anyone tried this?

This is the asp.net code:
[WebCategory("Appearance"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
DefaultValue("")]
public int CellPadding
{
get
{
string text1 = base.Attributes["cellpadding"];
if (text1 == null)
{
return -1;
}
return int.Parse(text1, CultureInfo.InvariantCulture);
}
set
{
base.Attributes["cellpadding"] =
HtmlControl.MapIntegerAttributeToString(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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top