如何创建asp.net的MVC动态的观点? [英] How to create dynamic views in asp.net mvc?

查看:129
本文介绍了如何创建asp.net的MVC动态的观点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建asp.net mvc的2.0动态视图?

How to create dynamic views in asp.net mvc 2.0?

推荐答案

一个更好的方式来思考这个是有呈现一些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.

这篇关于如何创建asp.net的MVC动态的观点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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