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.0Design QuestionDesign Question
Previous
 
Next
New Post
11/4/2008 10:12 PM
 

I'm writing a module for DNN using Visual Web Developer 2008 Express Edition.  I want to create a series of tabs across the top of the module that will allow me to choose what to display across the bottom of the module, just like the menu system in DNN.

But, I'm not all that familiar with VWD2008, and I'm not sure what the best approach would be to create this look, so I thought I'd ask you guys...

Should I use seperate .ascx files, a single page with HTML tables (toggling the visible setting of each object), panels, or a Multi-View approach?  I'm not sure which one of these methods would be the most efficient, they each seem to have their drawbacks.

 

 

 

 
New Post
11/6/2008 9:29 AM
 

Hi,

I myself currently use a single ascx control which is registered as control and use loadcontrol to load the various other ascx files in hidden placeholders and then togle the visibility of the placeholders. I also have the ascx controls strongly typed so i can attach events and properties to them (stuff like control_to_load1.finished += new eventhandler (etc...); and control_to_load1.someneededid = this.someneededid;)

It took me a while to get all the controls to load correctly (mostly had trouble with the communication between the controls, hence the strongly typed control classes) but since i have one working i use it more and more. I use this for wizards (tabs corresponding to step 1, step 2 etc...) and to split up my custom settings (tabs corresxponding to general settings, specific settings etc...)

hth,

Alexander

 
New Post
11/6/2008 4:54 PM
 

Cool... I'll have to look into that a bit more, would you be willing to share some code snips on how this is done?

I've been experimenting with a bunch of different methods, but none of them seem work quite right, looking at other modules shows the panel objects seems to be a popular method.  The best option I found so far was toggling the panel objects, but after adding in a lot of controls on one page I'm already starting to see the limitations.  VS seems to be acting up more with each additonal control I add, making editing an extremely difficult process while trying to work around the editing bugs.  Looks like I'll need to break the code into seperate pages to maintain stability.

 
New Post
11/7/2008 4:49 PM
 

I've been doing a bit more research on this, what is your opinion of the TemplateControl Class?  It looks like it is a template using the Page and UserControl classes, is that close to what you are doing?

 
New Post
11/20/2008 5:01 AM
 

Hi,

 I havn't worked with the templatecontroll class so i can not answer that question. I do however have some example code for your: 

 ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ConfigureModule.ascx.cs" Inherits="Leval.Modules.Module.ConfigureModule" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td valign="top" width="15%" align="left">
<dnn:Label ID="lblChooseShop" runat="server" suffix=":" />
</td>
<td valign="top" width="85%" align="left">
<asp:DropDownList ID="lstShop" runat="server" AutoPostBack="true"></asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td></tr>
<tr id="trConfig" visible="false" runat="server">
<td valign="top" width="15%" align="left">
    <asp:LinkButton ID="hlGeneral" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="general" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlInvoiceing" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="invoiceing" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlSmtp" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="smtp" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlPayment" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="payment" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlTaxZones" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="taxzones" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlShippingMethod" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="shippingmethod" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlShippingZones" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="shippingzones" CssClass="Head"></asp:LinkButton><br />
    <asp:LinkButton ID="hlShippingCost" runat="server" OnCommand="goConfigure" CommandName="Swap" CommandArgument="shippingcost" CssClass="Head"></asp:LinkButton><br />
</td>
<td valign="top" width="85%" align="left">
    <asp:PlaceHolder ID="plhGeneral" runat="server" Visible="true">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhInvoiceing" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhSmtp" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhPayment" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhTaxZones" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhShippingMethod" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhShippingZones" runat="server" Visible="false">
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="plhShippingCost" runat="server" Visible="false">
    </asp:PlaceHolder>
</td>
</tr>
</table>

.cs file:

namespace Modules.Module
{
    partial class ConfigureModule : PortalModuleBase, IModuleConfigure
    {
        private string _ShopId = "";
        private Hashtable CSettings;
        private CModuleConfigure ctlGeneral;
        private CModuleConfigure ctlInvoiceing;
        private CModuleConfigure ctlSmtp;
        private CModuleConfigure ctlPayment;
        private CModuleConfigure ctlTaxZones;
        private CModuleConfigure ctlShippingMethod;
        private CModuleConfigure ctlShippingZones;
        private CModuleConfigure ctlShippingCost;
        #region Event Handlers
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    loadShops();
                    hlGeneral.Text = Localization.GetString("hlGeneral.Text", this.LocalResourceFile);
                    hlInvoiceing.Text = Localization.GetString("hlInvoiceing.Text", this.LocalResourceFile);
                    hlSmtp.Text = Localization.GetString("hlSmtp.Text", this.LocalResourceFile);
                    hlPayment.Text = Localization.GetString("hlPayment.Text", this.LocalResourceFile);
                    hlTaxZones.Text = Localization.GetString("hlTaxZones.Text", this.LocalResourceFile);
                    hlShippingMethod.Text = Localization.GetString("hlShippingMethod.Text", this.LocalResourceFile);
                    hlShippingZones.Text = Localization.GetString("hlShippingZones.Text", this.LocalResourceFile);
                    hlShippingCost.Text = Localization.GetString("hlShippingCost.Text", this.LocalResourceFile);
                    ShowPanels(true, false, false, false, false, false, false, false);
                }
                _ShopId = lstShop.SelectedValue;
                if (_ShopId.Length > 0)
                {
                    loadSettings();
                    trConfig.Visible = true;
                }
                else
                {
                    trConfig.Visible = false;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        protected void goConfigure(Object sender, CommandEventArgs e)
        {
            switch (e.CommandName.ToLower())
            {
                case "swap":

                    switch (e.CommandArgument.ToString().ToLower())
                    {
                        case "general":
                            ShowPanels(true, false, false, false, false, false, false, false);
                            break;
                        case "invoiceing":
                            ShowPanels(false, true, false, false, false, false, false, false);
                            break;
                        case "smtp":
                            ShowPanels(false, false, true, false, false, false, false, false);
                            break;
                        case "payment":
                            ShowPanels(false, false, false, true, false, false, false, false);
                            break;
                        case "taxzones":
                            ShowPanels(false, false, false, false, true, false, false, false);
                            break;
                        case "shippingmethod":
                            ShowPanels(false, false, false, false, false, true, false, false);
                            break;
                        case "shippingzones":
                            ShowPanels(false, false, false, false, false, false, true, false);
                            break;
                        case "shippingcost":
                            ShowPanels(false, false, false, false, false, false, false, true);
                            break;
                    }
                    break;
            }
        }
        #endregion
        #region private functions
        private void loadShops()
        {
            RoleController RC = new RoleController();
            ModuleShopController CSC = new ModuleShopController();
            lstShop.Items.Clear();
            lstShop.Items.Add(new ListItem("...", ""));
            foreach (ModuleShopInfo CSI in CSC.GetModuleShops(this.PortalId))
            {
                ModuleShopPermissionController CSPM = new ModuleShopPermissionController();
                foreach (ModuleShopPermissionInfo CSPI in CSPM.GetModuleShopPermissionsByShop(CSI.ShopId))
                {
                    if (this.UserInfo.IsInRole(RC.GetRole(CSPI.RoleId, this.PortalId).RoleName))
                    {
                        lstShop.Items.Add(new ListItem(CSI.ShopName, CSI.ShopId));
                        break;
                    }
                }
            }
            if (_ShopId.Length == 0)
            {
                lstShop.SelectedIndex = 0;
            }
        }
        private void loadSettings()
        {
            CSettings = new ModuleSettings(_ShopId).Settings;
            loadGeneral();
            loadInvoiceing();
            loadSmtp();
            loadPayment();
            loadTaxZones();
            loadShippingMethod();
            loadShippingZones();
            loadShippingCost();
        }
        private void loadGeneral()
        {
            plhGeneral.Controls.Clear();
            ctlGeneral = (CModuleConfigure)LoadControl(ModulePath + "ConfigureGeneralModule.ascx");
            ctlGeneral.ID = "GeneralModule_control";
            ctlGeneral.ParentControl = this as PortalModuleBase;
            ctlGeneral.CConfigure = this as IModuleConfigure;
            ctlGeneral.CSettings = CSettings;
            plhGeneral.Controls.Add(ctlGeneral);
        }
        private void loadInvoiceing()
        {
            plhInvoiceing.Controls.Clear();
            ctlInvoiceing = (CModuleConfigure)LoadControl(ModulePath + "ConfigureInvoiceingModule.ascx");
            ctlInvoiceing.ID = "InvoiceingModule_control";
            ctlInvoiceing.ParentControl = this as PortalModuleBase;
            ctlInvoiceing.CConfigure = this as IModuleConfigure;
            ctlInvoiceing.CSettings = CSettings;
            plhInvoiceing.Controls.Add(ctlInvoiceing);
        }
        private void loadSmtp()
        {
            plhSmtp.Controls.Clear();
            ctlSmtp = (CModuleConfigure)LoadControl(ModulePath + "ConfigureSmtpModule.ascx");
            ctlSmtp.ID = "SmtpModule_control";
            ctlSmtp.ParentControl = this as PortalModuleBase;
            ctlSmtp.CConfigure = this as IModuleConfigure;
            ctlSmtp.CSettings = CSettings;
            plhSmtp.Controls.Add(ctlSmtp);
        }
        private void loadPayment()
        {
            plhPayment.Controls.Clear();
            ctlPayment = (CModuleConfigure)LoadControl(ModulePath + "ConfigurePaymentModule.ascx");
            ctlPayment.ID = "PaymentModule_control";
            ctlPayment.ParentControl = this as PortalModuleBase;
            ctlPayment.CConfigure = this as IModuleConfigure;
            ctlPayment.CSettings = CSettings;
            plhPayment.Controls.Add(ctlPayment);
        }
        private void loadTaxZones()
        {
            plhTaxZones.Controls.Clear();
            ctlTaxZones = (CModuleConfigure)LoadControl(ModulePath + "ConfigureTaxZonesModule.ascx");
            ctlTaxZones.ID = "TaxModule_control";
            ctlTaxZones.ParentControl = this as PortalModuleBase;
            ctlTaxZones.CConfigure = this as IModuleConfigure;
            ctlTaxZones.CSettings = CSettings;
            plhTaxZones.Controls.Add(ctlTaxZones);
        }
        private void loadShippingMethod()
        {
            plhShippingMethod.Controls.Clear();
            ctlShippingMethod = (CModuleConfigure)LoadControl(ModulePath + "ConfigureShippingMethodModule.ascx");
            ctlShippingMethod.ID = "ShippingMethodModule_control";
            ctlShippingMethod.ParentControl = this as PortalModuleBase;
            ctlShippingMethod.CConfigure = this as IModuleConfigure;
            ctlShippingMethod.CSettings = CSettings;
            plhShippingMethod.Controls.Add(ctlShippingMethod);
        }
        private void loadShippingZones()
        {
            plhShippingZones.Controls.Clear();
            ctlShippingZones = (CModuleConfigure)LoadControl(ModulePath + "ConfigureShippingZonesModule.ascx");
            ctlShippingZones.ID = "ShippingZonesModule_control";
            ctlShippingZones.ParentControl = this as PortalModuleBase;
            ctlShippingZones.CConfigure = this as IModuleConfigure;
            ctlShippingZones.CSettings = CSettings;
            plhShippingZones.Controls.Add(ctlShippingZones);
        }
        private void loadShippingCost()
        {
            plhShippingCost.Controls.Clear();
            ctlShippingCost = (CModuleConfigure)LoadControl(ModulePath + "ConfigureShippingCostModule.ascx");
            ctlShippingCost.ID = "ShippingCostModule_control";
            ctlShippingCost.ParentControl = this as PortalModuleBase;
            ctlShippingCost.CConfigure = this as IModuleConfigure;
            ctlShippingCost.CSettings = CSettings;
            plhShippingCost.Controls.Add(ctlShippingCost);
        }
        #endregion
        #region IModuleConfigure
        public void ShowPanels(bool pnlGeneral, bool pnlInvoiceing, bool pnlSmtp, bool pnlPayment, bool pnlTaxZones, bool pnlShippingMethod, bool pnlShippingZones, bool pnlShippingCost)
        {
            plhGeneral.Visible = pnlGeneral;
            plhInvoiceing.Visible = pnlInvoiceing;
            plhSmtp.Visible = pnlSmtp;
            plhPayment.Visible = pnlPayment;
            plhTaxZones.Visible = pnlTaxZones;
            plhShippingMethod.Visible = pnlShippingMethod;
            plhShippingZones.Visible = pnlShippingZones;
            plhShippingCost.Visible = pnlShippingCost;
        }
        public string ShopId
        {
            get
            {
                return _ShopId;
            }
        }
        #endregion
    }
}


and the imoduleconfigure type (compiled cs class):

namespace Leval.Modules.Module.Is
{
    public interface IModuleConfigure
    {
        void ShowPanels(bool pnlGeneral, bool pnlInvoiceing, bool pnlSmtp, bool pnlPayment, bool pnlTaxZones, bool pnlShippingMethod, bool pnlShippingZones, bool pnlShippingCost);
        string ShopId { get;}
    }
}

 

and one of the strongly typed classes (CModuleConfigure here, also compiled cs class):

namespace Modules.Module.Cs
{
    public abstract class CModuleConfigure : CModule_Basis
    {
        protected IModuleConfigure _CConfigure;

        public IModuleConfigure CConfigure
        {
            get { return _CConfigure; }
            set { _CConfigure = value; }
        }
    }
}
 

And the basis class to complete it:

namespace Modules.Module.Cs
{
    public class CModule_Basis : PortalModuleBase
    {
        #region Private Declarations
        protected PortalModuleBase _ParentControl = new PortalModuleBase();
        protected Hashtable _CSettings;

        #endregion

        #region PortalModuleBase Overrides
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                this.LocalResourceFile = DotNetNuke.Services.Localization.Localization.GetResourceFile(this, this.GetType().BaseType.Name + ".ascx");
                this.ModuleConfiguration = _ParentControl.ModuleConfiguration;
                base.OnLoad(e);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        #endregion


        #region Public Properties
        public Hashtable CSettings
        {
            get
            { return _CSettings; }
            set
            { _CSettings = value; }
        }
        public PortalModuleBase ParentControl
        {
            get { return _ParentControl; }
            set { _ParentControl = value; }
        }
        #endregion
    }
}
 

 

HTH

Alexander

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Design QuestionDesign Question


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