By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,247 Members | 2,145 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,247 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
"Eric Sabine" wrote:
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

Nov 19 '05 #2

P: n/a
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.
"Shaw" <Sh**@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
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
"Eric Sabine" wrote:
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

Nov 19 '05 #3

P: n/a
I mean that the outside of user control, such as page, tries to access child
controls of that user control.

Shaw
"Edward W." wrote:
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.
"Shaw" <Sh**@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
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
"Eric Sabine" wrote:
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


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.