How to refer a contol in userControl

A

ad

I put a Web User Controls in a Form.
The ID of the User Control is uc1.
But if I write the code like
uc1.Button1.text="New Text"
It will fail when complie time, and the error message is

uc_ascx.Button1is inaccessible due to its protection level

How can I public the button in User Control?
 
B

Brock Allen

You will need to either user uc1.FindControl("Button1") or make a public
property on your UserControl that returns the Button.
 
A

ad

Thank,
But I cann't find any place to set the protection level of control in User
Control.
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top