I have a aspx page default.aspx on this page is a panel control and I load ascx user controls in to the panel. Like this.
That is all working, But! Now I need to call the sub loadpanel from the ascx page so I can load a new ascx usercontrol on a button click. Something like thisCode:Public Sub loadpanel(ByVal filename As String) Session("page") = filename 'If File.Exists(Request.MapPath(fileName)) Then Dim demo As System.Web.UI.Control = Page.LoadControl(filename) Panel1.Controls.Add(demo) 'End If End Sub
Code on the ascx page to call the sub on the default.aspx
This is not the correct syntacs so how do I do this??Code:Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As Loadpanel(“top.ascx”) ‘ This sub is on the deafult.aspx page End Sub




Reply With Quote