Master Page properties



Hello-

I am missing something very easy here I think.

I have 3 files

test.master.vb (Master)
content.aspx.vb (content)
Control.ascx.vb (user Control)

All 3 work fine together, but I am not being able to get/set parameters
like I think I should. I think it has something to do with in the order
of the load events. Please see the <<<<<Problem areas>>>>>> in below
code.

Thanks,
Chris



----------------------------
test.master.vb
--------------------------------
Imports System.Web.Security

Namespace TEST
Partial Class Master
Inherits System.Web.UI.MasterPage

Private m_UserId As String = -1
Private m_PageTitle As String

Public Property PageTitle() As String
Get
Return m_PageTitle
End Get
Set(ByVal value As String)
m_PageTitle = value
End Set
End Property

Public Property UserId() As String
Get
Return m_UserId
End Get
Set(ByVal value As String)
m_UserId = value
End Set
End Property


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

m_UserId = 2

' set page title coming from content pages
Title.Text = "Test Site"
If m_PageTitle <> "" Then Title.Text += " - " & m_PageTitle

End Sub
End Class
End Namespace




----------------------------
content.aspx.vb
----------------------------
Imports System.Web.Security

Namespace TEST
Partial Class Brands
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Master.PageTitle = testUserControl.BrandName

testUserControl.UserId = Master.UserId
''''<<<<<Master.UserId IS SET TO -1, not what the masterpage Page_Load
sets it to>>>>>>

End Sub
End Class
End Namespace




----------------------------
Control.acsx.vb
----------------------------
Namespace AVB.Controls

Partial Class SupplierCategories
Inherits System.Web.UI.UserControl

Private m_BrandName As String

Public Property BrandName() As String
Get
Return m_BrandName
End Get
Set(ByVal value As String)
m_BrandName = value
End Set
End Property


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load


If Not IsPostBack Then
m_BrandName = "Title From User COntrol" ''' <<<<<NEVER
MAKES IT TO MASTER PAGE via content.aspx.vb Page_Load >>>>>>


End Sub


End Class

End Namespace

.



Relevant Pages

  • Re: Visual Studio requires that designers use the first class the the file.
    ... There's a partial class in ... when creating a user control with Visual Basic .NET, ... when I try it view it in Design mode. ... The first line is "Namespace MyStuff". ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Not able to put class into namespace
    ... asp.net uses partial the partial class model to combine the codebenind file and the class file generated by the page compile. ... if the namspace of the page (which defines the control names) is different then the namespace in codebehind, then you need to fully qualify the control names as they are in a differnt namespace. ... You could also make the namespace of the page match the codebehind namespace via the ClassName in the directive. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Partial Classes across different namespaces ?
    ... public partial class X ... private void MyMethod ... namespace a.b.c.d ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I really hate .NET especially inside Delphi
    ... you might imagine, yes. ... It is confusing to see that if you use the namespace, you get the whole partial class, but if you use one of it units, you get only a part of the ... but it also shows how confusing it is to have two almost identical solutions for a single problem in the same product. ...
    (borland.public.delphi.non-technical)
  • Compilation Error
    ... namespace System.Data ... partial class Console ... public partial class DataGrid ...
    (microsoft.public.dotnet.languages.csharp)

Loading