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.0Dropdown in module settings to choose which view the module will display?Dropdown in module settings to choose which view the module will display?
Previous
 
Next
New Post
3/17/2009 11:14 PM
 

Tanks to the articles from Michael I was able to create several very simple and basic but for us very useful modules, everyone basically a single ASCX file:

  • one module displays our employee list (empl_list.ascx)
  • one module displays a birthday list (bd_list.ascx)
  • one module displays a department list (dept_list.ascx)
  • etc.

Now as these modules belong to the same concern (and database) I would like to integrate them in one module, let's say Module "Employee Data", where our user can choose from a dropdown in the module settings what information (see above) the module instance will display. How can I achieve that?

 
New Post
3/18/2009 7:18 AM
 

Save a setting using

ModuleController objModules = new ModuleController();
objModules.UpdateTabModuleSetting(TabModuleId, "controlToDisplay", DropDownList1.SelectedValue);

The value could be an int then put your controls in a multiview control and set the selectedviewindex to which ever part of the multiview you want to display.  Or use some if statements to decide from your settings value which controls you want to make visible and which invisible.

 
New Post
3/19/2009 8:06 AM
 

Thanks for your answer, Simon. Maybe you or someone else can help, why my created settings.aspx does not appear anywhere:

  • I created a settings.aspx
  • I inherited from the ModuleSettingsBase and overrode LoadSettings() and UpdateSettings()
  • I registered a new module definition for settings.aspx as "Edit" type

When I now click on the buttons for module settings on a instance of my module the settings.aspx is not displayed but only the normal settings which are available for every module.

 
New Post
3/30/2009 11:42 PM
 

Ok, I found the solution for the previous issue: Instead of adding two definitions (one with a view and one with a edit control), I had to add only one definition and there add two Module Controls (one view and one edit control).

Anyways now I am facing the following issue: Although my code seems to be correct, everytime I load the page with the module the same first view appears instead of that one picked by the dropdown in the module settings. My code:

In settings.ascx.cs:

public partial class Settings : DotNetNuke.Entities.Modules.ModuleSettingsBase
{
    public override void LoadSettings() {
        try
        {
            if ((Page.IsPostBack == false))
            {
                if ((TabModuleSettings["employeesql_selectedview"]) == null)
                {
                    TabModuleSettings["employeesql_selectedview"] = 0;
                }
                ddnViewSelector.SelectedIndex = Convert.ToInt32(TabModuleSettings["employeesql_selectedview"]);
            }
        }
        catch (Exception exc)
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }

    public override void UpdateSettings()
    {
        try
        {
            DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
            objModules.UpdateTabModuleSetting(ModuleId, "employeesql_selectedview", Convert.ToString(ddnViewSelector.SelectedIndex));
        }
        catch (Exception exc)
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }
}
 

In view.ascx.cs:

protected void Page_Load(object sender, System.EventArgs e)
    {
        if (Page.IsPostBack)
        {
        }
        else
            {      
                ModuleController objModules = new ModuleController();
                int goTo = System.Convert.ToInt32(objModules.GetTabModuleSettings(TabModuleId)["employeesql_selectedview"]);
               
                switch (goTo) {
                    case 0: employeeSQLViews.ActiveViewIndex = 0; break;
                    case 1: employeeSQLViews.ActiveViewIndex = 1; break;
                    case 2: employeeSQLViews.ActiveViewIndex = 0; break;
                    case 3: employeeSQLViews.ActiveViewIndex = 4; break;
                    case 4: employeeSQLViews.ActiveViewIndex = 2; break;
                    case 5: employeeSQLViews.ActiveViewIndex = 3; break;
                    default: employeeSQLViews.ActiveViewIndex = 0; break;
                }
               
            }
    }

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dropdown in module settings to choose which view the module will display?Dropdown in module settings to choose which view the module will display?


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