读取html文件并在asp.net页中显示 [英] Read Html file and display in asp.net page

查看:74
本文介绍了读取html文件并在asp.net页中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在10个不同的按钮单击上读取10个html文件.
(每次点击一个html文件)
并在垂直格中显示该html内容.
当我单击一个按钮时,它会读取并显示第一个html文件内容
当我单击2按钮时,应将第二个文件的html内容替换为第一个html内容.
我该怎么办.请提供详细的解决方案.
thanx.

I want to read 10 html files on 10 different button click.
(one html file on each click)
and display that html content in perticular div.
when i click on 1 button it read and show the first html file content
and when i click on 2 button it should replace the first html content with second file''s html content.
How can i do it.please provide the detail solution.
thanx.

推荐答案

假设您正在使用ID为"myContent"的ContentPlaceHolder,您可以尝试执行以下操作:

Assuming you''re using a ContentPlaceHolder wuith an ID of "myContent", you can try something like this:

public void UpdateContent(object sender, EventArgs e) 
{
    HtmlContainerControl div = new HtmlContainerControl( "DIV" );
    div.innerHTML = "....whatever...";     
    myContent.Controls.Clear();     
    myContent.Controls.Add(div); 
}



编辑==================

您说我没有使用任何控件".

好吧,如果您使用的是Asp.Net,则避免使用框架的内置功能绝对没有道理.我的建议是使用ContentPlaceHolder.您必须增强自己的能力,或者承受遇到的困难(并学习Google).



EDIT ===================

You said "I''m not using any controls".

Well, if you''re using Asp.Net, it makes absolutely no sense to avoid using the built-in capabiliyties of the framework. My advice is to use a ContentPlaceHolder. You have to empower yourself, or suffer the difficulties that you encounter (and learn to google).


这篇关于读取html文件并在asp.net页中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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