如何动态地将aspx页面添加到从MS sql数据库中的不同表中读取数据的网站 [英] How to dynamically add aspx pages to a website that read data from different tables in a MS sql database

查看:64
本文介绍了如何动态地将aspx页面添加到从MS sql数据库中的不同表中读取数据的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个新闻网站,其中有几个类别,如政治,技术,公告,Ob告等(每个类别是sql server express数据库中的一个表)...所有这些类别都显示在菜单标签中。点击每个标签后,它将导航到相应的页面。大多数页面具有相同的结构(皮肤或主题)。这是网站的工作。我正在使用visual studio 2010和ms sql server 2008.



我不想为每个类别创建页面。是否有任何可能的方法来动态创建页面以在单击菜单时调用sql server中的每个表。



顺便说一句,有另一种需求是否有任何方法通过提供类别名称(如类别名称== facebook)和印刷机创建来托管网站后创建新类别。



提前感谢.. 。:)



(我的一位朋友告诉我使用查询字符串。像〜/ catagory / category?page = urpage)

i am trying to develop a news website that have several categories like Politics, Technology, Announcement, Obituary, etc(Each category is a table in the sql server express database)... All these Categories are shown in a menu tab.When each tab clicked it will navigate to corresponding pages. Most of the pages have same structure (Skin or theme) . that is the working of the site. i am using visual studio 2010 and ms sql server 2008.

I don't want create pages for each categories. Is there is any possible way to create pages dynamically to call each tables in the sql server when clicking the menu.

By the way, have another need is there any way to create new category after hosting the site by just giving the name of the category, like category name == facebook, and the press create.

thanks in advance... :)

(One of my friend told me to use query string. something like ~/catagory/category?page=urpage)

推荐答案

有几种方法可以达到你想要的效果:



#让您的页面由不同的部分组成根据所选用户的选择异步更新。你需要为此实现相当数量的javascript,所以使用jQuery来实现跨浏览器的可靠性。此外,您的网站是数据驱动的,所以使用一个良好的JavaScript mvc框架将是一个巨大的胜利。

如果你有时间你可以查看其中之一:

AngularJS

淘汰赛



#使用主页面和内容页面,有一个共同的内容页面,并根据所选的类别更新其数据。

如果你不这样做,请看这个创建内容页面我们已经知道了。

链接



#您甚至可以创建一个单独的aspx页面来显示类别数据并使用iframe来显示该页面,但这是我最不喜欢的,因为我看过iframes在移动设备上造成很多问题你不会喜欢。
There are several ways in which you can achieve what you want:

# Have your page made up of different parts which will update asynchronously according to the selected choice of the users. You will need to implement a decent amount of javascript for this so use jQuery for cross browser reliability. Also your website is data driven so using a good javascript mvc framework would be a big win.
If you have time you can view one of these:
AngularJS
Knockout

# Use master and content pages, have a common content page and update its data based on the category selected.
See this to create content pages if you don't know already.
Link

# You can even create a separate aspx page to show the category data and use an iframe to display that page, but this is my least favourite because I have seen iframes causing many problems on mobile devices and you wouldn't like that.


这篇关于如何动态地将aspx页面添加到从MS sql数据库中的不同表中读取数据的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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