how to dynamically load the aspx page in div tag ?

前端 未结 1 1754
渐次进展
渐次进展 2021-01-07 08:27

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 sug

相关标签:
1条回答
  • 2021-01-07 08:51

    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 讨论(0)
提交回复
热议问题