保存网页并将其显示在浏览器中 [英] Save the web page and display it in a browser
本文介绍了保存网页并将其显示在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Am正在开发具有n个页面的项目,并且在我的母版页中有2个按钮保存"和显示"..
当我单击保存"按钮时,它应该保存当前页面的内容.然后导航到其他页面,当我单击显示"按钮时,我应该显示已保存的页面内容...在此帮助我
Am Developing the project with n number of pages, and in my master page am having 2 buttons "Save" and "Display"..
when i click "Save" button , it should save the current page content. and then i navigated to some other pages and when i click the "Display" button, i should display the saved page content...Help me in this
推荐答案
create页面类中的私有字符串成员pagehtml.
在页面事件中重写PreRenderComplete并使用以下代码.
create a private string member pagehtml in your page class.
override PreRenderComplete in page event and use the following code.
StringWriter strWrt = new StringWriter();
HtmlTextWriter htmText = new HtmlTextWriter(strWrt);
base.Render(htmText);
StringBuilder html = strWrt.GetStringBuilder();
pagehtml = html.ToString();
使用时,单击保存",将Pagehtml保存到文件.
When use click on save, save the pagehtml to a file.
这篇关于保存网页并将其显示在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文