【问题标题】:How do I add settings to my DNN Module如何将设置添加到我的 DNN 模块
【发布时间】:2015-08-26 13:42:56
【问题描述】:

如何将设置选项卡添加到我的 DNN 模块?

我已将我的用户控件作为模块添加到 DNN,但我不知道如何添加设置选项卡以使某些值变得可配置。

【问题讨论】:

    标签: .net dotnetnuke dotnetnuke-7


    【解决方案1】:

    希望您使用的是我的 Visual Studio 模板,它们使进行 DNN 模块开发,包括设置,超级简单

    https://visualstudiogallery.msdn.microsoft.com/bdd506ef-d5c3-4274-bf1d-9e673fb23484

    设置很简单,无需使用我的模板,这里有一个 ASCX 用于设置

    <fieldset>
        <div class="dnnFormItem">
            <dnn:label ID="lblPageSize" runat="server" ControlName="txtPageSize" />
            <asp:TextBox ID="txtPageSize" runat="server" />
        </div>
        <div class="dnnFormItem">
            <dnn:label ID="lblShowCategories" runat="server" ControlName="chkShowCategories">
            </dnn:label>
            <asp:CheckBox ID="chkShowCategories" runat="server" />
        </div>
    </fieldset>
    

    然后是后面的代码

    public override void LoadSettings()
    {
        try
        {
            if (Page.IsPostBack == false)
            {
                //Check for existing settings and use those on this page
                //Settings["SettingName"]
                txtPageSize.Text = PageSize.ToString();
            }
        }
        catch (Exception exc) //Module failed to load
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }
    
    public override void UpdateSettings()
    {
        try
        {
            PageSize = Convert.ToInt32(txtPageSize.Text);
        }
        catch (Exception exc) //Module failed to load
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }
    

    从我的一个开源模块中提取的示例

    http://dnnsimplearticle.codeplex.com/SourceControl/latest#cs/

    【讨论】:

      【解决方案2】:

      要让 DNN 将您的用户控件连接到模块设置下的设置选项卡,您需要将新的 moduleControl 定义添加到您的 .dnn 清单文件中。下面是 Chris 的 simplearticle 示例模块中的示例。

      <moduleControl>
          <controlKey>Settings</controlKey>
          <controlSrc>DesktopModules/dnnsimplearticle/Settings.ascx</controlSrc>
          <supportsPartialRendering>False</supportsPartialRendering>
          <controlTitle>dnnsimplearticle Settings</controlTitle>
          <controlType>Edit</controlType>
          <iconFile />
          <helpUrl />
          <viewOrder>0</viewOrder>
      </moduleControl>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多