Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Why are we using abstract/MustInherit in .ascx controls ?Why are we using abstract/MustInherit in .ascx controls ?
Previous
 
Next
New Post
5/27/2008 8:38 AM
 

I am wondering what is the reason, that the .ascx Controls classes, that we use in DNN Modules are declared MustInehrit / abstract

What is the pros/cons of removing this modifier ?

 
New Post
5/27/2008 10:04 AM
 

This is primarily a hold-over from the DNN 3/ASP.NET 1.1 days.

IMO - there are no cons in removing the Abstract/MustInherit modifier.  But there are not really any pros either.

Theoretically - removing the modifier removes the ability to "instantiate" the class declared in the "code-behind".  That is all.  In reality there are very few (if not no)  reasons why you would instantiate the code behind class - and not want the inherited "ascx" version of the class.  Remember that the ascx "inherits" or sub-classes the code behind, so if you instantiated the code behind directly you would get none of the html layout of the control - just the code aspects.

In DNN4/ASP.NET 2, we use the code-beside model a lot - if you use that model the code file is declared as a Partial class and is combined with the ascx file - rather than the ascx file inheriting from the code file.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
5/27/2008 10:26 AM
 

Isn't the partial class just between the codebehind and the designer file (Pagename.ascx.vb and Pagename.ascx.designer.vb)?  The ascx files I see are still using an Inherits attribute.  I still can't get at code that is declared internal from my ascx.  Am I misunderstanding what's going on there?

Thanks,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
5/27/2008 10:39 AM
 

Brian

You might be right - I was basing my comments on what I had heard on podcasts like Dot net Rocks.  I haven't actually looked into that aspect.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
5/28/2008 4:57 AM
 

Right, so I guess, it is safe to declare the class as abstract/MustInherit, right ?

What I would like to know is, should I add MyBase.Load and Me.Load, both to the Page_Load event handler ?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Why are we using abstract/MustInherit in .ascx controls ?Why are we using abstract/MustInherit in .ascx controls ?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out