动态更改aspx页面上的文本的控件. [英] Control for Dynamically Changing the text on an aspx page.

查看:69
本文介绍了动态更改aspx页面上的文本的控件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
请帮助我!

我有一个aspx页面,上面硬编码了一些新闻文章.我想要的是每次我对该文件(txt或doc)进行更改时,从一个单独的.Txt或.Doc文件中提取这些文章,并将其显示在我的页面上)它应该反映在我的页面上(例如添加新的新闻文章并删除旧的新闻文章).我不想对新闻文章进行硬编码.有人告诉我有关将要执行此操作的控件.任何帮助或建议表示赞赏.


我希望你能理解我的问题.
感谢您的阅读!

Hi everyone,
PLEASE HELP ME OUT!!!

I Have an aspx page on which some News Articles are hardcoded.What I want is to Pull out these articles from a separate .Txt or .Doc file and show it on my page moreover, everytime i made changes to that file(txt or doc) it should reflect on my page(say new news articles are added and old ones are deleted).I don''t want to hardcode the news articles.Some one told me about a control that will do this..Any sort of help or suggestions are appreciated.


I hope u understand my problem.
thanks for reading!!!

推荐答案

谢谢你们的帮助.但这是我在谷歌搜索2个小时后才发现的.
www.dynamicdrive.com/dynamicindex2/ajaxticker.htm [
Thanks Guys for your kind help..but this is what i figured out after 2 hrs of Googling
www.dynamicdrive.com/dynamicindex2/ajaxticker.htm[^] May be this could help else i''ll try your solutions..

Thanks a lot!!!!!


尝试
Try Google[^], its called Content Management System (CMS)


使用文字控件并放置Div控件中的文字控件

如果您使用母版页,最好在母版页的页面加载事件中编写此代码.

Use literal control and Place literal control within Div control

if you are using Master Page It Would be better to write this code in master page''s Page Load Event.

 protected void Page_Load(object sender, EventArgs e)
{

string path = "YourTextFilePath";

if(!string.IsNullOrEmpty(path))

{

string[] readText = File.ReadAllLines(path);

StringBuilder strbuild = newStringBuilder();

foreach (string s in readText)

{

strbuild.Append(s);

strbuild.AppendLine();

}

Lit.Text = strbuild.ToString();

}

}


这篇关于动态更改aspx页面上的文本的控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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