Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Inheriting from System.Web.UI.WebControls.Table

Reply
Thread Tools

Inheriting from System.Web.UI.WebControls.Table

 
 
Jimmy [Used-Disks]
Guest
Posts: n/a
 
      08-14-2003
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(DesignerSerializat ionVisibility.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 -

--
-Jimmy
Used-Disks:
http://www.used-disks.com/


 
Reply With Quote
 
 
 
 
Jimmy [Used-Disks]
Guest
Posts: n/a
 
      08-14-2003
> 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?


Found it! The answer is to apply the ParseChildren(true) and
PersistChildren(false) attributes to the control class because the Table
class had overridden the WebControls default implementation which is the
behavior we desired.

Thanks for reading .

--
-Jimmy
Used-Disks:
http://www.used-disks.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inheriting class with private constructor Michael Carr ASP .Net 1 12-29-2003 04:59 AM
Inheriting System.UI.ControlCollection for a WebControl - FindControl doesn't work??? Harry F. Harrison ASP .Net 0 12-18-2003 06:28 PM
Inheriting from base form Andy Breward ASP .Net 1 11-07-2003 06:15 AM
inheriting from a class that inherits from the UserControl class Joel Barsotti ASP .Net 4 10-30-2003 08:05 PM
Inheriting local variables from a common source? Wayne J ASP .Net 2 10-24-2003 05:59 PM



Advertisments