我如何在DNN中填充下拉式FOM数据库 [英] How can i populate dropdown fom database in dnn

查看:87
本文介绍了我如何在DNN中填充下拉式FOM数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在DNN站点中添加新页面,该页面从数据库中填充了国家和州两个下拉列表。

I want to add new page in the DNN site which populates two dropdown for Country and State from the database.

请提出我们该如何做的建议? p>

Please suggest how we can do this?

推荐答案

在这里,我向您展示如何使用DNN模块创建动态页面。有关更多信息,请参见此链接

Here I show you how to create dynamic pages using DNN module. For more information refer this link.


  1. 首先在Visual Studio中打开DNN网站。您可以在根目录中看到 DesktopModules 文件夹,右键单击该目录并添加新目录,将其命名为模块名称,例如 CountryState。现在,右键单击 CountryState 文件夹,然后依次单击Add-> Add New Item->选择 Web用户控件,并将其命名为您的模块名称,例如 CountryState.ascx,它将在DesktopModules / CountryState文件夹中显示CountryState.ascx和CountryState.ascx.cs文件。

  2. 下一步将继承类 System.Web.UI.UserControl更新为 PortalModuleBase 。这是因为PortalModuleBase类定义了门户网站内所有桌面门户网站模块继承的自定义基类。 PortalModuleBase类定义门户网站框架用来正确显示门户网站模块的特定于门户网站的属性。

  3. 现在使用主机凭据登录到您的网站。

  4. 在DNN面板中,转到主机->扩展。

  5. 单击右上方的创建新模块按钮

  6. 创建新模块按钮打开一个带有创建模块表单 DropDownList的弹出窗口。从该下拉列表中选择 Control

  7. 它将显示您的表单,从中选择您的.ascx Web用户控件作为相应的文件夹路径,然后单击创建模块按钮。

  8. 最后在页面上拖放模块。

  9. 享受吧! ;)

  1. First of all open your DNN website in Visual Studio. You can see the DesktopModules folder in your root directory, right click on the directory and add new directory give it to name as your module name, for example "CountryState". Now right click on the CountryState folder and Add->Add New Item->Select Web User Control and give it to name as your module name like "CountryState.ascx", it will show you CountryState.ascx and CountryState.ascx.cs files in DesktopModules/CountryState folder.
  2. Next step to update inherit class "System.Web.UI.UserControl" to "PortalModuleBase". This is because of the PortalModuleBase class defines a custom base class inherited by all desktop portal modules within the Portal. The PortalModuleBase class defines portal specific properties that are used by the portal framework to correctly display portal module.
  3. Now logged-In in your website using your Host credential.
  4. In DNN panel, go-to Host->Extensions.
  5. Click on Create New Module button on right top corner of the Extensions Page.
  6. Create New Module button open a popup window with Create Module Form DropDownList. Select Control from that Drop-Down.
  7. It will show you form, select your .ascx web user control in that from as respected folder path and click on Create Module button.
  8. Finally Drag-N-Drop module on your page.
  9. Enjoy! ;)

这篇关于我如何在DNN中填充下拉式FOM数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆