Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error while trying to get to user control properties

Status
Not open for further replies.

ietprofessional

Programmer
Apr 1, 2004
267
US
Hi!

Code:
Dim i As controlname = New controlname 
Dim i2 As LinkButton = CType(i.FindControl("lnkServices"), LinkButton)
i2.Visible = False

I keep getting this error when I try to make a link button invisible that is in a user control:
Object reference not set to an instance of an object.

Any ideas?

Tanks!
 
Searches the current naming container for a server control with the specified id parameter."
It could be that
Dim i As controlname = New controlname
has no children so i.FindControl("lnkServices") returns Nothing.


Compare Code
 
How do you suggest doing this?

I definitely know there is a linkbutton in this user control because I created it.

THANKS!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top