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

Discussion in 'ASP .Net' started by Eric Sabine, Jan 27, 2005.

  1. Eric Sabine

    Eric Sabine Guest

    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
    Eric Sabine, Jan 27, 2005
    #1
    1. Advertising

  2. 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
    >
    >
    =?Utf-8?B?U2hhdw==?=, Jan 28, 2005
    #2
    1. Advertising

  3. Eric Sabine

    Edward W. Guest

    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" <> wrote in message
    news:...
    >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
    >>
    >>
    Edward W., Jan 28, 2005
    #3
  4. Re: Certain controls aren't accessable at runtime in a custom cont

    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" <> wrote in message
    > news:...
    > >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
    > >>
    > >>

    >
    >
    >
    =?Utf-8?B?U2hhdw==?=, Jan 28, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dominic
    Replies:
    0
    Views:
    432
    Dominic
    Nov 3, 2004
  2. Annie
    Replies:
    1
    Views:
    292
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Sep 7, 2005
  3. Bruce Hodge
    Replies:
    0
    Views:
    411
    Bruce Hodge
    Feb 15, 2006
  4. Jim Walseth
    Replies:
    0
    Views:
    301
    Jim Walseth
    Oct 23, 2003
  5. douha
    Replies:
    1
    Views:
    312
    Toby Inkster
    Jan 4, 2007
Loading...

Share This Page