开发者

how to dynamically load the aspx page in div tag ?

开发者 https://www.devze.com 2023-04-05 14:38 出处:网络
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 th

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.

T开发者_开发知识库hanks in advance


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

in HTML file

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

in CS file

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消