简体   繁体   English

更新页面的一部分以显示“新闻”(不使用数据库) Asp.net C#

[英]Updating a section of a page to show “News” (Without using a database) Asp.net C#

I want to have a news section to my page in a placeholder which can be updated relatively frequently with just Text and a Date.我想在占位符中为我的页面添加一个新闻部分,该占位符可以仅使用文本和日期相对频繁地更新。

But I do not want it to be linked to a Database, Is there a way this can be done?但我不希望它链接到数据库,有没有办法做到这一点?

If you are not prepared to use a Database, keep it as static content.如果您不准备使用数据库,请将其保留为 static 内容。 Another option would be to use a simple text or xml file and read this in.另一种选择是使用简单的文本或 xml 文件并将其读入。

You could save the news as an RSS file (simply an XML file format suited for news) and then parse and display it in asp.net.您可以将新闻保存为 RSS 文件(只需适合新闻的 XML 文件格式),然后将其解析并显示为 asp.net。

Here's a tutorial to get you started:这是一个帮助您入门的教程:

http://www.codeproject.com/KB/XML/RSSFeedEx.aspx http://www.codeproject.com/KB/XML/RSSFeedEx.aspx

You could try using RSS feeds , example here您可以尝试使用RSS 提要,例如这里

If by not linked you mean not bound , yeah.如果未链接,则表示未绑定,是的。 Use ajax to fetch news on a specified interval and append them to your element at client-side.使用 ajax 在指定的时间间隔获取新闻,并使用 append 将它们发送到客户端的元素。 If you're not talking about binding, then you need a news source which could be:如果您不是在谈论绑定,那么您需要一个新闻来源,它可以是:

  1. An RSS feed RSS 提要
  2. An XML document XML 文件
  3. A database一个数据库
  4. A flat text file纯文本文件
  5. An Excel spreadsheet Excel 电子表格

and more sources, in which you have to someway write the code to fetch the information and update the UI.以及更多来源,您必须在其中编写代码以获取信息并更新 UI。 That's inevitable.这是不可避免的。

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

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