Certain controls aren't accessable at runtime in a custom control

E

Eric Sabine

I've created a custom control (ascx) which contains a tree view, a drop
down list, and a listbox. The custom control is included in a web form
and at runtime, won't compile (I get the "inaccessible due to its
protection level" error) because the NodePopulate event of the treeview
is set to private. So I changed it to "protected" and the app compiles
fine and runs and properly reacts to the event. Good.

The problem is inside that event, I reference the "SelectedValue"
property of both the dropdownlist and the listbox. At runtime in this
event, both resolve to empty strings ("") but I know both controls have
do have an item selected, so there seems to be some type of access
issue. Any idea?

Eric
 
G

Guest

I think, you need to create properties in user (custom) control level which
access child control’s properties. A book said to do that way, but I haven’t
try it yet.

Shaw
 
E

Edward W.

What? The custom control contains 3 controls. Are you saying the custom
control should also expose a property of itself and thus in the event
handler of one of the controls, the custom control should refer to itself?
that makes no sense. Please explain a little better what you are trying to
say. You make no sense.
 
G

Guest

I mean that the outside of user control, such as page, tries to access child
controls of that user control.

Shaw
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top