Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing mm.net web controls
Message
From
12/11/2003 07:36:07
Jacci Adams
Lindsay-Adams Consulting
Louisville, Ohio, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00848727
Message ID:
00849029
Views:
24
Hi Paul,

Thank you, thank you! And thank you Neil for asking the question.

Not only do these steps apply to MM but any other classes a developer might want to subclass. (Of course the names will be different.)

Jacci


>
>It must be your lucky day (either that, or I've got lots of free time this week).
>
>- First, create a new project:
>
> - Click on File->New Project
> - Select Visual C# Projects (or VB Projects, if you prefer)
> - Select "Class Library" - pick a name, and directory
>
>- Right-click on "References" in the "Solution Explorer" -> Add Reference
> - Select Project, navigate to C:\Program Files\Mere Mortals .NET Framework 2003\Mere Mortals Framework Web Forms
> - select " Mere Mortals Framework Web Forms.dll"
>
>This tells VS.NET that we are using classes defined in that file (and how to find it)
>
>- Right-click on "References" in the "Solution Explorer" -> Add Reference
> - On the ".NET" tab scroll down and select "System.Web.dll". Click the "Select" button, then click on OK.
>
>Same as above.
>
>- Select "Class1.cs" tab
>- Fix the namespace to your standards (eg. MyCompany.Web.UI.WebControls)
>- Add a "using System.Web;" to the top.
>- Add a "using OakLeaf.MM.Main.Web.UI.WebControls;" to the top.
>
>- Select "Class1.cs" in the "Solution Explorer" and rename it to something nicer (eg. myButton.cs) by
> right-clicking and selecting "Rename"
>
>This is basically the class name of the control we're subclassing. We're going to start with the mmButton control first, so name it accordingly.
>
>- Change the line:
> public class Class1
>
>to:
>
> public class myButton : OakOakLeaf.MM.Main.Web.UI.WebControls.mmButton
>
>
>and the constructor line:
>
>public class Class1()
>
>to:
>
>public class myButton()
>
>This tells VS.NET that myButton is now a subclass of the mmButton control in MM.NET
>
>- Modify this class any way you'd like (eg. change the font, size, additional logic, etc.)
>- Save this class.
>- Right-click on your project in the "Solution Explorer", select "Add->Add Class"
> - Name the new class "myCheckbox.cs" (we're going to now subclass the mmCheckbox)
>- Adjust the namespace like we did for the first class and add a "using", inherit from
> OakLeaf.MM.Main.Web.UI.WebControls.mmCheckbox
>- For each new control: Rinse, Lather, Repeat.
>
>
>To add your subclassed MM.NET web controls to toolbox:
> - With a web project open:
> - Open, right-click on Add Tab, type in "My MM.NET Web Controls"
> - Select new tab, right-click below it and select "Add/Remove Items"
> - Browse to your new control DLL and select it (usually in FolderProjectName\bin\Debug)
>
>To use your new controls in a web form, make sure you add a reference to the .dll file where your controls are located.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform