473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
3 1543
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john | last post by:
I searched http://www.sellsbrothers.com. and could not find anything about this subject. How do I make C# User Controls Visible to Visual Basic 6.0 Applications? Thanks, John
4
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
1
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named...
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
4
by: Smokey Grindle | last post by:
What is the best way to write dynamic controls in ASP.NET 2.0?
15
by: Arpan | last post by:
Consider the following code which retrieves data from a SQL Server 2005 DB table & displays it in a DataGrid: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
4
by: TS | last post by:
Steven, i lost this message conversation from outlook express and made a post online (see last one on this page). Please answer it as it hasn't been yet. thanks The clientID of our controls...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.