Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 5 - Creating Custom Modules
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Creating Custom Modules
By: PACKT Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2005-08-04

    Table of Contents:
  • Creating Custom Modules
  • Setting Up Your Project (Private Assembly)
  • Creating Controls Manually in Visual Studio
  • Module Edit Control
  • Module Settings Control
  • Adding Module Definitions
  • Adding Your Module to a Page

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Creating Custom Modules - Module Settings Control


    (Page 5 of 7 )

    The DotNetNuke framework allows you to add customized settings to the Module Settings Page. To do this you need to implement a Settings control.

    To set up the Settings control follow the steps we took to create the View control with the following exceptions.

    • Do not implement the IPortable, IActionable, and ISearchable interfaces.

    • Change the text in the table to say OptionModuleRowOne and OptionModuleRowTwo.
    • Save the file as Settings.ascx.

    Add the following to the HTML section:

    <%@ Control language="vb" AutoEventWireup="false" Inherits="EganEnterprises.CoffeeShopListing.Settings" CodeBehind="Settings.ascx.vb"%>

    In the code-behind section it gets a little tricky. As opposed to the other two controls, this control inherits from ModuleSettingsBase instead of PortalModuleBase. This causes a problem in the Visual Studio designer when you attempt to view your form in design mode. The Visual Studio designer will show the following error.

    This is because the ModuleSettingsBase has two abstract methods that we will need to implement: LoadSettings and UpdateSettings. So unless you want to design your control using only HTML, you will need to use the following workaround.

    When you need to see this control in the designer, just comment out the Inherits ModuleSettingsBase declaration and both the public overrides methods (LoadSettings and UpdateSettings), and instead inherit from the PortalModuleBase. You can then drag and drop all the controls you would like to use from the toolbox and adjust them on your form. When you are happy with how it looks in the designer, simply switch over the Inherits statements. For now, the only code we need in the code-behind file for this control is the one below. We will add to this code once we have created the DAL (Data Access Layer)

    Imports DotNetNuke

    Namespace EganEnterprises.CoffeeShopListing

      Public Class Settings
        Inherits Entities.Modules.ModuleSettingsBase
        'Inherits Entities.Modules.PortalModuleBase

        Private Sub Page_Load(ByVal sender As _
        System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
          'Put user code to initialize the page here
        End Sub

        Public Overrides Sub LoadSettings()
        End Sub

        Public Overrides Sub UpdateSettings() 
        End Sub
      End Class

    End Namespace

    Just like the other controls, add an HTML table to the control so we can test our modules to this point.

     

    With all your controls complete, build your project and verify that it builds successfully. At this point, the module still cannot be viewed in a browser within the DotNetNuke framework. To do this you will first need to add module definitions to the portal.

    More Visual Basic.NET Articles
    More By PACKT Publishing


     

    Buy this book now. This article is excerpted from chapter seven of the book Building Websites with VB.NET and DotNetNuke 3.0, written by Daniel N. Egan (PACKT Publishing, 2005; ISBN: 1904811272). Check it out today at your favorite bookstore. Buy this book now.

    VISUAL BASIC.NET ARTICLES

    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway