Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing mm.net web controls
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00848727
Message ID:
00848859
Views:
16
YEAH!

>Thank you. This materual should be included in the mm.net developer's guide (I hope Kevin is listening). You are in deed, the mm.net MVP.
>
>All in agreement say, yeah.
>
>Regards,
>Neil
>
>>>Thank you Paul,
>>>
>>>I now understand the concept. However now my problem is a little bit more mechanical in nature. How do I create a project of only mm.net web controls. And... once done, how do I make the subclassed controls a member of the toolbox?
>>>
>>>PS Kevin requested that I send him my free table DataAccessClass Wizard that was so motivated by your contributions. No final descision on it until version mm 1.1 is complete.
>>>
>>
>>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
Reply
Map
View

Click here to load this message in the networking platform