Groups | Blog | Home
all groups > asp.net webcontrols > november 2003 >

asp.net webcontrols : User Controls


sdavenport NO[at]SPAM sigcom.net
11/6/2003 8:37:53 AM
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.

anonymous NO[at]SPAM discussions.microsoft.com
11/6/2003 9:14:55 AM
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.
sdavenport NO[at]SPAM sigcom.net
11/7/2003 7:09:39 AM
Jim
11/7/2003 7:26:48 AM
Not a problem, hope it worked for you


[quoted text, click to view]
AddThis Social Bookmark Button