且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建asp.net的MVC动态的观点?

更新时间:2023-02-16 11:33:07

一个更好的方式来思考这个是有呈现一些HTML的管理员定义和它得到存储在数据库中的通用视图页面。另一种方法是创建静态HTML文件 - 假设的内容是固定的,或者可以通过AJAX检索 - 并且具有动态从通用视图选择这些HTML文件的一个观点。我用后一种方法,使一个链接聚合网站,我已经把维护他人的某些部分。它呈现HTML片段(存储在内容/静态/ *。HTM )上使用jQuery的索引页/视图的固定部分负荷。该管理员可以访问修改这些文件重新整理/添加/删除包含页面的那一部分的链接。该应用程序正处于发展的初期阶段,最终这些都将迁移到任何配置文件,我将生成的HTML,也许我会制定一个管理界面来管理他们,让他们在数据库中。

A better way to think about this is to have a generic view page that renders some HTML that administrator defines and which gets stored in a database. Another alternative would be to create static HTML files -- assuming the content is fixed or could be retrieved via AJAX -- and have a view which dynamically chooses which of these HTML files to from your generic view. I use this latter method to make certain parts of a link aggregator site I've put together maintainable by others. It renders HTML fragments (stored in content/static/*.htm) onto fixed parts of the index page/view using jQuery load. The admins have access to modify these files to rearrange/add/delete the links contained on that part of the page. The app is at an early stage of development and eventually these will migrate either into configuration files, and I will generate the HTML, or perhaps I'll develop an administrative interface to manage them and keep them in the DB.