J
Jimmy [Used-Disks]
I am trying to create an ASP.NET control by inheriting from Table. I would
like to stop the Rows property from being displayed/persisted at
design-time, plus I would like to have new properties I have introduced be
persisted as nested tags within my controls tag in the ASP.NET page. To do
this I have overridden the Rows property as follows:
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
PersistenceMode(PersistenceMode.InnerProperty)]
public override TableRowCollection Rows{
get{
return base.Rows;
}
}
This succesfully hides the Rows property from the properties window in the
IDE, however when other properties are persisted within the tags, it throws
an exception (at both design and run time):
"System.Web.UI.WebControls.TableRowCollection must have items of type
'System.Web.UI.WebControls.TableRow'. 'MyCustomProperty' is of type
'System.Web.UI.HtmlControls.HtmlGenericControl'."
I have also tried using "new" instead of "override" to re-declare the Rows
property and have gotten the same results.
My question is, how do I get around this? I do *not* want a
DefaultInnerProperty for my control because I am trying to generate all the
TableRows programatically and need to persist other properties as Inner
Properties. Is there any way around this, such as an attribute I can apply
to the Rows property or to my control?
Thanks -
like to stop the Rows property from being displayed/persisted at
design-time, plus I would like to have new properties I have introduced be
persisted as nested tags within my controls tag in the ASP.NET page. To do
this I have overridden the Rows property as follows:
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
PersistenceMode(PersistenceMode.InnerProperty)]
public override TableRowCollection Rows{
get{
return base.Rows;
}
}
This succesfully hides the Rows property from the properties window in the
IDE, however when other properties are persisted within the tags, it throws
an exception (at both design and run time):
"System.Web.UI.WebControls.TableRowCollection must have items of type
'System.Web.UI.WebControls.TableRow'. 'MyCustomProperty' is of type
'System.Web.UI.HtmlControls.HtmlGenericControl'."
I have also tried using "new" instead of "override" to re-declare the Rows
property and have gotten the same results.
My question is, how do I get around this? I do *not* want a
DefaultInnerProperty for my control because I am trying to generate all the
TableRows programatically and need to persist other properties as Inner
Properties. Is there any way around this, such as an attribute I can apply
to the Rows property or to my control?
Thanks -