.NETGURU
Having trouble with codebehind and usercontrols
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngreuse' list.


Rob Ellis
-- Moved from [aspngfreeforall] to [aspngreuse] by Marcie Jones <Click here to reveal e-mail address> --

I've created a user control and given it a public property with get/set
accessors.

Using vs.net, I've dragged&dropped it into an aspx page which has a
codebehind page associated with it.

I want to set the usercontrols public property within the aspx's codebehind
page (I assume in the page load event).

When I try to call the public property ie. "usercontorl.user_id =1",
intellisense doesn't kick in. I'm assuming that means that the control is
not within scope. But I am accessing it from the codebhind page which
creates a refernce to the user control.

Help!

Reply to this message...
 
    
Little, Ambrose
Make sure that the control is declared as a property of your code-behind
page class. Also ensure that you have the assembly containing the control
referenced and that the proper namespaces are being used in the control
declaration.

--Ambrose

[Original message clipped]

******************************************************************************
The Company reserves the right to amend statements
made herein in the event of a mistake. Unless expressly
stated herein to the contrary, only agreements in writing signed
by an authorized officer of the Company may be enforced against it.
*******************************************************************************

Reply to this message...
 
    
Shane Kempton
You'll need to declare the user control as an object on the code behind =
page. For example

Protected MyUserControl1 as MyUserControl

-----Original Message-----
From: Rob Ellis [mailto:Click here to reveal e-mail address]
Sent: Monday, May 06, 2002 12:35 PM
To: aspngreuse
Subject: [aspngreuse] Having trouble with codebehind and usercontrols

-- Moved from [aspngfreeforall] to [aspngreuse] by Marcie Jones =
<Click here to reveal e-mail address> --

I've created a user control and given it a public property with get/set
accessors.

Using vs.net, I've dragged&dropped it into an aspx page which has a
codebehind page associated with it.

I want to set the usercontrols public property within the aspx's =
codebehind
page (I assume in the page load event).

When I try to call the public property ie. "usercontorl.user_id =3D1",
intellisense doesn't kick in. I'm assuming that means that the control =
is
not within scope. But I am accessing it from the codebhind page which
creates a refernce to the user control.

Help!

| [aspngreuse] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngreuse.asp =3D JOIN/QUIT

Reply to this message...
 
    
Brent Giesler
There's a great article about this in May's ASP.NetPRO magazine. If your
control is not precompiled, you have to use reflection to discover it's
type. This articles explains how to implement that.

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification