如何动态地加载aspx页面中div标签? [英] how to dynamically load the aspx page in div tag ?

查看:392
本文介绍了如何动态地加载aspx页面中div标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家喜...
                我想一个aspx页面的内容加载到另一个aspx页面的div标签,我不想使用jQuery它。任何人都可以请建议我在服务器端解决方案来动态加载div标签上点击按钮。

Hi everybody... I am trying to load the contents of one aspx page into div tag of another aspx page, i dont want to use jquery for it. can anybody please suggest me the server side solution to load the div tag dynamically on click of button.

在此先感谢

推荐答案

刚刚得到的网页它的自我,并将其发送到控制

Just get the page it self and send it to the control

HTML 文件

<div class="code">
    <pre><asp:Literal id="litCode" runat="server /></pre>
</div>

CS 文件

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        populate();
}

private void populate()
{
    litCode.Text = getSoureCodeFromFile("http://localhost:21300/Search.aspx");
}

private string getSoureCodeFromFile(string url)
{
    string r = "";
    using (WebClient wc = new WebClient())
    {
        r = wc.DownloadString(url);
    }
    return r;
}

这篇关于如何动态地加载aspx页面中div标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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