简体   繁体   English

如何通过动态导航制作动态内容?

[英]How do I make dynamic content with dynamic navigation?

I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. 我正在创建一个ASP.NET网站,所有页面都挂在数据库驱动的树层次结构上。 Pages typically present HTML content. 页面通常显示HTML内容。 But, some will execute programming. 但是,有些将执行编程。

Examples: 例子:

  1. a "contact us" form “与我们联系”表格
  2. a report generator 报告生成器

How should I represent/reference the programming within the database? 我应该如何表示/引用数据库中的程序? Should I have a varchar value of a Web User Control (.ascx) name? 是否应该具有Web用户控件(.ascx)名称的varchar值? Or a Web Form (.aspx) name? 还是Web窗体(.aspx)名称? Something else? 还有吗 Or should it just be an integer or other such ID in a dictionary within my application? 还是在我的应用程序的字典中只是整数或其他此类ID?

Can I make an ASP.NET Site Map Provider with this structure? 我可以使用这种结构制作ASP.NET站点地图提供程序吗?

See more information here: Which is the best database schema for my navigation? 在此处查看更多信息: 哪种导航最适合我的导航?

You might consider inserting placeholders like <my:contact-us-form/> in the database on specific pages; 您可以考虑在特定页面的数据库中插入诸如<my:contact-us-form/>类的占位符; that way the database can describe all the static text content instead of completely replacing that database-driven content with an .ascx control. 这样数据库就可以描述所有静态文本内容,而不用.ascx控件完全替换该数据库驱动的内容。

Our development team has had success with defining the name of a Web User Control in the database. 我们的开发团队已经成功地在数据库中定义了Web用户控件的名称。 Upon page load it checks too see what controls to dynamically load from the database. 页面加载后,它还会检查要从数据库动态加载的控件。

We use Web User Controls instead of Web Forms in order to ensure we can use the control on any page. 我们使用Web用户控件而不是Web窗体,以确保我们可以在任何页面上使用该控件。

You can also dynamically build a site map using ASP.Net's provider. 您还可以使用ASP.Net的提供程序动态构建站点地图。 CodeProject has a good example. CodeProject有一个很好的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM