检索和SQL数据库显示动态内容到ASP.NET页 [英] Retrieving and displaying dynamic content from SQL database into ASP.NET pages
问题描述
我目前工作的新闻门户网站在asp.net的发展。我创建了一个表中的SQL Server 2008的参数(NewSID的,NewsTitle,NewsDetails,新闻分类)。我现在可以从数据库动态检索NewsTitle在我的aspx页面显示出来。
现在我想通过NewSID的该特定NewsTitle,然后在一个单独的aspx页面检索NewsDetails。什么是ASP.NET这样做的最好的事情?我不希望创建新的ASPX页面都要向NewsTitle一个链接被点击的时间,而我有兴趣使用相同的详细信息页面,并通过不同的ID参数?
I am currently working on the development of news portal website in asp.net. I have created a table in sql server 2008 with parameters (NewsId, NewsTitle, NewsDetails, NewsCategory). I am now able to dynamically retrieve the NewsTitle from the database and displaying it in my aspx page. Now I want to pass the NewsId for that particular NewsTitle and then retrieve the NewsDetails in a separate aspx page. What is the best thing to do this in ASP.NET? I don't want to create new aspx pages every time a link to the NewsTitle is clicked, rather I am interested to use the same Details page and pass different ID parameters?
问候,
推荐答案
我让他们都在同一个页面上,并使用类似的面板切换能见度采用主从复合模式:
I'd keep them both on the same page and employ a master-details pattern using something like panels to toggle the visibility:
<一个href=\"http://leedumond.com/blog/master-detail-editing-inserting-deleting-with-a-listview-and-detailsview/\" rel=\"nofollow\">http://leedumond.com/blog/master-detail-editing-inserting-deleting-with-a-listview-and-detailsview/
这会给你的基本理念;样品挂同时显示了,但我说这是一个简单的事情,打开和关闭他们在点击按钮。
This will give you the basic idea; the sample linked to shows both, but as I said it is a simple matter to toggle them on and off on the click of a button.
这篇关于检索和SQL数据库显示动态内容到ASP.NET页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!