B
Brent
This is one of those issues where I'm wondering if i'm going about this the
right way...
In a user control, I need a reference to an instance of the parent page's
class. How do you get it?
--------
Why do i need it? I have a page, Page1, with 2 user controls: UC1 and UC2.
The 1st user control has a dropdownlist (ddl). The 2nd control contains the
javascript (js) biz logic that calls a js function (in a .js file). The
function in the js file has to know the clientID of the ddl so that it can
create a reference to it. To get the ddl clientID all the way to the js
function, Page1 has a DDLUsersClientID property that UC1 sets and UC2 reads.
The problem is that i don't know how to get a reference to Page1 from UC1.
Page1
------------------
Public Class Page1
Inherits System.Web.UI.Page
Public Property DDLUsersClientID() As String
Get
Return mstrDDLUsersClientID
End Get
Set(ByVal ClientIDIN As String)
mstrDDLUsersClientID = ClientIDIN
End Set
End Property
UC1 on Page1
-------------------
Public Class SubscribeShowSolutions
Inherits System.Web.UI.UserControl
Public cPage1 As Page1
Protected ddlUsers As DropDownList
cPage1 = Parent. ? ? ?
cPage1.DDLUsersClientID = ddlUsers.ClientID 'Set ddluserclientid to parent
page so that UC2 can read it and pass it to js fct.
Thanks for any advice!
Brent
BugMonitor.com
right way...
In a user control, I need a reference to an instance of the parent page's
class. How do you get it?
--------
Why do i need it? I have a page, Page1, with 2 user controls: UC1 and UC2.
The 1st user control has a dropdownlist (ddl). The 2nd control contains the
javascript (js) biz logic that calls a js function (in a .js file). The
function in the js file has to know the clientID of the ddl so that it can
create a reference to it. To get the ddl clientID all the way to the js
function, Page1 has a DDLUsersClientID property that UC1 sets and UC2 reads.
The problem is that i don't know how to get a reference to Page1 from UC1.
Page1
------------------
Public Class Page1
Inherits System.Web.UI.Page
Public Property DDLUsersClientID() As String
Get
Return mstrDDLUsersClientID
End Get
Set(ByVal ClientIDIN As String)
mstrDDLUsersClientID = ClientIDIN
End Set
End Property
UC1 on Page1
-------------------
Public Class SubscribeShowSolutions
Inherits System.Web.UI.UserControl
Public cPage1 As Page1
Protected ddlUsers As DropDownList
cPage1 = Parent. ? ? ?
cPage1.DDLUsersClientID = ddlUsers.ClientID 'Set ddluserclientid to parent
page so that UC2 can read it and pass it to js fct.
Thanks for any advice!
Brent
BugMonitor.com