User Controls

S

Scott D

I am having problems making the textboxes and other controls
avaialable to the code-behind page of an ASPX page with multiple user
controls inserted into it. I believe I need to make the ASCX
textboxes and controls avaialble publicly but do not know how to
accomplish this task.

Thank you.
 
G

Guest

You need to change the declaration of the objects in
your .ascx code-behind file to Public.

Change this:
Protected WithEvents TextBox1 As
System.Web.UI.WebControls.TextBox

To this:
Public WithEvents TextBox1 As
System.Web.UI.WebControls.TextBox

However this is not a very secure way to do it but it
works. You should really declare Get and Set properties
in the .ascx to set or retrieve the values
ex Public Property <property name>
This will generate a Get And Set function automatically or
you can declare a function. Either must be set public for
you to use.
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top