B
Big Charles
Hello,
I don't know how UserControl should work:
If I put MyPlaceHolder.Controls.Add(MyUsrControl) inside "If (Not
Page.IsPostBack) Then", when MyWebForm is loaded, the usercontrol is
not loaded.
Why not?
Example:
Public Class MyWebForm
Inherits System.Web.UI.Page
Private MyUsrControl As Control =
LoadControl("../myUsrControl.ascx")
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
MyPlaceHolder.Controls.Add(MyUsrControl) ' Does not work.
Why?
End If
MyPlaceHolder.Controls.Add(MyUsrControl) ' Here it works
End Sub
I don't know how UserControl should work:
If I put MyPlaceHolder.Controls.Add(MyUsrControl) inside "If (Not
Page.IsPostBack) Then", when MyWebForm is loaded, the usercontrol is
not loaded.
Why not?
Example:
Public Class MyWebForm
Inherits System.Web.UI.Page
Private MyUsrControl As Control =
LoadControl("../myUsrControl.ascx")
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
MyPlaceHolder.Controls.Add(MyUsrControl) ' Does not work.
Why?
End If
MyPlaceHolder.Controls.Add(MyUsrControl) ' Here it works
End Sub