R
RSH
Hi,
I have a situation where I have a page built in .Net 1.1 that I have a
PlaceHolder in the Design. From the CodeBehind I am dynamically referencing
a user control.
This is a snippet from the the CodeBehind from that page:
Dim mc As MainContent = New MainContent <----User Created Control
Select Case Trim(Session("UserType"))
Case "Corp"
mc.DisplayContent = "TESTCO"
Case "Service Center"
mc.DisplayContent = "TESTSC"
End Select
PlaceHolder1.Controls.Add(mc)
The Control has a property called DisplayContent that accepts the ContentID
for that page. The code in the ascx file is simple...basically there is a
placeholder in the Design view, and in the codebehind Property I am calling
a function. That code looks like this:
Public Property DisplayContent() As String
Get
Return DisplayContent
End Get
Set(ByVal Value As String)
If Len(Trim(Session("UserType"))) > 0 Then
LoadContent(Value, Trim(Session("UserType")))
End If
End Set
End Property
The problem is that for some reason The "Session("UserType") = Nothing" when
I step through the code in the control which doesn't make any sense because
the session variable exists in the select statement on the aspx page that
calls the control.
How do I get the control to see the Session variables?
Thanks!
Ron
I have a situation where I have a page built in .Net 1.1 that I have a
PlaceHolder in the Design. From the CodeBehind I am dynamically referencing
a user control.
This is a snippet from the the CodeBehind from that page:
Dim mc As MainContent = New MainContent <----User Created Control
Select Case Trim(Session("UserType"))
Case "Corp"
mc.DisplayContent = "TESTCO"
Case "Service Center"
mc.DisplayContent = "TESTSC"
End Select
PlaceHolder1.Controls.Add(mc)
The Control has a property called DisplayContent that accepts the ContentID
for that page. The code in the ascx file is simple...basically there is a
placeholder in the Design view, and in the codebehind Property I am calling
a function. That code looks like this:
Public Property DisplayContent() As String
Get
Return DisplayContent
End Get
Set(ByVal Value As String)
If Len(Trim(Session("UserType"))) > 0 Then
LoadContent(Value, Trim(Session("UserType")))
End If
End Set
End Property
The problem is that for some reason The "Session("UserType") = Nothing" when
I step through the code in the control which doesn't make any sense because
the session variable exists in the select statement on the aspx page that
calls the control.
How do I get the control to see the Session variables?
Thanks!
Ron