|
-
Jan 4th, 2007, 02:25 AM
#1
Thread Starter
Hyperactive Member
[2005] Need help accessing control in webzone
I did a search for webzone here, and googled, but couldn't find anything to help.
I am playing with webzones to get familiar with them, and I am trying to change the text in a label in a webzone on the page load event, but I am getting Object reference not set to an instance of an object.
Here is my code.
VB Code:
Dim TN As Label = Me.ReportDetailsZone.FindControl("TeacherName".ToString)
TN.Text = "This is how to add text to a control in a webzone."
TN.Dispose()
TN = Nothing
I am guessing that my find control code is not finding the control so TN = nothing. I just can't seem to find any code examples to see if I am finding the code wrong, or not.
Thank you for your help.
-
Jan 5th, 2007, 07:55 AM
#2
Re: [2005] Need help accessing control in webzone
VB Code:
Dim TN As Label = CType(Me.ReportDetailsZone.FindControl("TeacherName"), Label)
Also, note that saying
Code:
"TeacherName".ToString
is as redundant as sterilizing needles before executions.
-
Jan 6th, 2007, 03:34 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Need help accessing control in webzone
Thank you, mendhak, for your reply. I gave it a try, but it didn't work. I got the same error on the line that assigns the text property. I did go back and verify that the id is correct, and it is. Any other ideas?
-
Jan 9th, 2007, 07:16 AM
#4
Re: [2005] Need help accessing control in webzone
My next question would be, is the Label you're looking for inside another control inside the web part control?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|