G
Guest
Hi,
I am building a page that makes use of user control as a templating
technique. The following is that I have in mind and it is actually working:
Root/
-- login.aspx
-- login.aspx.vb
-- UC/
----- Classic/
--------- skin_login.ascx
----- Blue/
--------- skin_login.ascx
----- skin_login.ascx.vb
as you can see, login.aspx has a partial class defined in login.aspx.vb. The
folder UC/ contains 2 templates for login.aspx, Classic and Blue.
skin_login.ascx are in the two folders Classic/ and Blue/ that inherit the
same partial class skin_login.ascx.vb in a level above (right under UC/).
I am dynamically loading either "Blue/skin_login.ascx" or
"Classic/skin_login.ascx" based on user preference into login.aspx and I want
to be able to reference the web controls defined in skin_login.ascx in
login.aspx. The following is the logic:
In login.aspx.vb
===========
Private Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Init
Dim loginURControl As Control = LoadControl("~/UC/" + Page.Theme +
"/skin_login.ascx")
loginFormSkinHolder.Controls.Add(loginURControl)
End Sub
===========
loginFormSkinHolder is a placeholder control in login.aspx, and I am loading
the user control based on the Page.Theme of the page. I create a same name
folder under UC/ for each theme I have under APP_themes.
Inside the user control there is a dropdown list with ID SetTheme. I can
reference it in login.aspx by using:
loginURControl.FindControl("SetTheme")
but what I wanted to do is I want to reference it by using
loginURControl.SetTheme
and I am not sure how I can do that. Any suggestion is deeply appreciated. I
have tried casting loginURControl from Control to something else like the
following:
==========
Dim loginURControl As Control = LoadControl("~/UC/" + Page.Theme +
"/skin_login.ascx")
Dim typedLoginURControl as ? = Ctype(loginURControl , ?)
==========
but I don't know what I should specify as the type. I have tried the
filename of the User control (skin_login) but it didn't work (intelliSense
can't recognize it and the page can't compile)
I hope I have explained my situation very clearly. Any help is deeply
appreciated.
I am building a page that makes use of user control as a templating
technique. The following is that I have in mind and it is actually working:
Root/
-- login.aspx
-- login.aspx.vb
-- UC/
----- Classic/
--------- skin_login.ascx
----- Blue/
--------- skin_login.ascx
----- skin_login.ascx.vb
as you can see, login.aspx has a partial class defined in login.aspx.vb. The
folder UC/ contains 2 templates for login.aspx, Classic and Blue.
skin_login.ascx are in the two folders Classic/ and Blue/ that inherit the
same partial class skin_login.ascx.vb in a level above (right under UC/).
I am dynamically loading either "Blue/skin_login.ascx" or
"Classic/skin_login.ascx" based on user preference into login.aspx and I want
to be able to reference the web controls defined in skin_login.ascx in
login.aspx. The following is the logic:
In login.aspx.vb
===========
Private Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Init
Dim loginURControl As Control = LoadControl("~/UC/" + Page.Theme +
"/skin_login.ascx")
loginFormSkinHolder.Controls.Add(loginURControl)
End Sub
===========
loginFormSkinHolder is a placeholder control in login.aspx, and I am loading
the user control based on the Page.Theme of the page. I create a same name
folder under UC/ for each theme I have under APP_themes.
Inside the user control there is a dropdown list with ID SetTheme. I can
reference it in login.aspx by using:
loginURControl.FindControl("SetTheme")
but what I wanted to do is I want to reference it by using
loginURControl.SetTheme
and I am not sure how I can do that. Any suggestion is deeply appreciated. I
have tried casting loginURControl from Control to something else like the
following:
==========
Dim loginURControl As Control = LoadControl("~/UC/" + Page.Theme +
"/skin_login.ascx")
Dim typedLoginURControl as ? = Ctype(loginURControl , ?)
==========
but I don't know what I should specify as the type. I have tried the
filename of the User control (skin_login) but it didn't work (intelliSense
can't recognize it and the page can't compile)
I hope I have explained my situation very clearly. Any help is deeply
appreciated.