P
Paul
I have a MasterPage that has on it several UserControls (*ascx files). I
wish to control the visibility of the controls on the content pages
according to some parameter (for example on a user control that depends on a
param StoreID, for the UserControl to be visible only if StoreID is in the
query string.)
How can I access a UserControl in a MasterPage from a Content page?
I tried this, and variations thereof, but get errors:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim StoreID As Integer = Convert.ToInt32(Request.QueryString("StoreId"))
If Not StoreID.ToString Is Nothing Then
'Master.FindControl("ProductsByStoreAndCategoryUC.ascx").Visible = True
Dim myLocalMasterPage As MasterPage = Me.Master
Dim myControl As UserControl =
myLocalMasterPage.FindControl("CategoriesByStoreUC.ascx")
myControl.Visible = True
End If
End Sub
------------------------------------------
Thank you for any help,
Paul
wish to control the visibility of the controls on the content pages
according to some parameter (for example on a user control that depends on a
param StoreID, for the UserControl to be visible only if StoreID is in the
query string.)
How can I access a UserControl in a MasterPage from a Content page?
I tried this, and variations thereof, but get errors:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim StoreID As Integer = Convert.ToInt32(Request.QueryString("StoreId"))
If Not StoreID.ToString Is Nothing Then
'Master.FindControl("ProductsByStoreAndCategoryUC.ascx").Visible = True
Dim myLocalMasterPage As MasterPage = Me.Master
Dim myControl As UserControl =
myLocalMasterPage.FindControl("CategoriesByStoreUC.ascx")
myControl.Visible = True
End If
End Sub
------------------------------------------
Thank you for any help,
Paul