简体   繁体   中英

ASP.NET Load Control Problems Using VB.NET

I have an ASP.NET page (Page A) that has some HTML and a single HTML control that loads a form (Control A). When I am finished saving the form in Control A, I want the HTML control in Page A to load the next control. I have been unable to make this work and any help would be greatly appreciated.

This is the code I am using in Control A to trigger the function in Page A to load the control.

    Protected Sub btnSave2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave2.Click
    Try
        Dim ctest As New frmMain
        ctest.NextButton()
    Catch ex As Exception

This is the function in Page A that is being fired, but not loading anything

    Public Sub NextButton()
    Dim cname As New Control
    cname = LoadControl("EP/ctlE1_01_03.ascx")
    Me.dvContent.Controls.Add(cname)
End Sub

使用虚拟路径:

cname = LoadControl("~/EP/ctlE1_01_03.ascx")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM