473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Property Get/Set Problem in User Control

I have a user control that acts as a header for the parent page that it is
sitting on. I was having some errors with it and per another users
suggestion in this newsgroup, it cleared up my problem by executing the
function from the PreRender event of my user control. I set the property's
value from the page load event of the parent form. Now, the problem is that
I am setting the property and I see it come in just fine, but by the time I
get to the function that uses it, it is set as Nothing again. What is wrong
with this and how do I fix it? Below is my code.

Thanks in advance!
Private strPageName As String
Public Property PageName() As String
Get
Return strPageName
End Get
Set(ByVal Value As String)
strPageName = Value
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs Handles MyBase.Load
If Not Page.IsPostBack Then
GetPaths()
End If
End Sub

Private Sub GetPaths()
GetPaths Code Here....
End Sub

Public Sub SetHeaderInfo(ByVal strPageHeader As String, Optional ByVal
strMessage As String = "")

'Set table display style
Select Case strPageName
Case "CreateEDIAccount"
Me.tblHeader.Attributes.Add("class", "IndWin")
tblHeader.Width = "100%"
Case "Invoice Detail", "CreditMemo Detail"
Me.tblHeader.Attributes.Add("class", "InvDtl")
Case Else
Me.tblHeader.Attributes.Add("class", "subcat")
End Select

lblPageHeader.Text = strPageHeader

If strPageName <> "CreateEDIAccount" And strPageName <> "Sales Terms"
Then
If Request.QueryString("SalesForce") <> "LogInAsTM" Then
lnkHome.Target = "_top"
lnkHome.NavigateUrl = sPathSecure & "/default.aspx"
Else
lnkHome.Target = "_top"
lnkHome.NavigateUrl = sPathSecure & "/admin/AccountList.aspx"
End If
End If

lblMessage.Text = strMessage

End Sub

Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender

SetHeaderInfo(strPageName)

End Sub
May 2 '06 #1
0 1295

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Job Lot | last post by:
I have added a ProgressBar control to StatusBar control and created a custom property as below, to show the properties of the ProgressBar in Property Window of StatusBar. <Browsable(True)> _...
1
by: Steven.Xu | last post by:
Hi, everyone. I am writting an user control. There has some properties on it. At the design time, the properties will disply on the property windows and user could change it's value after selected...
3
by: Karl Lang | last post by:
Hi, I'm trying to set a property of a user control that is part of another user control. So I have a control A which contains control B, and I'm trying to set a property in B from within the...
15
by: Mark Goldin | last post by:
I have main aspx page with a number of user controls. How can I create a global property that will be visible in every user control? Thanks
1
by: Nathan Sokalski | last post by:
I have a problem that is driving me crazy. I have a User Control composed of three DropDownLists that will be used to select a date. I have everything working except for one thing. When I select a...
6
by: active | last post by:
In VB6 I could invoke a tool ( don't remember how right now) that would enable me to create properties in my user control that passed through properties of components on the user control. I...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
1
by: shapper | last post by:
Hello, I am creating a user control where an Asp.Net control is used. It can be either a button, an image button or a label. I am trying to "expose" the Asp.Net control properties and events...
2
by: Benton | last post by:
Hi there, I'm creating a custom server control, inheriting from TextBox. It has this AsDateTime property that returns the textbox contents converted to the nullable DateTime data type, as...
18
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.