Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Elizabeth Harmon #1
Passign Javascript From User Control to Parent(host) Page
Good Afternoon
I am hoping for some help for a problem i am struggling with. I am using a
Parent Page to Dynamically load my user Controls
based on a menu selection the user clicks. The User controls all work great
and everything loads correctly.
As Parent Page Coded in VB/ASP.NET:
private Sub Page_Load() 'omitted for brevity
dim strControl as string
Select Case Request.QueryString("controlToLoad")
case "BBS"
strControl = "Controls/BBS.ascx"
Case "BES"
strControl = "Controls/BBS.ascx"
end Select
Page.Controls.Add(LoadControl(strControl))
end Sub
On this Parent page is a LiteralControl. I am trying to pass Back Javascript
to the Parents Literal Control from the User Control.
I declared the Control this way on the Parent Page:
Public myLiteralControl as System.Web.UI.WebControls.Liuteral
If i import the Parent Page Class into the User Control, i can see the
Literal Control in the intellisense, but at runtime i get an error saying
the Object is not available or set to a null reference. I need to pass
javascript code for clientside validation and to perform some tasks based on
the control that is loaded. I am doing this on the Page Load of the User
Control. Am i just adding it in the wrong place?
here is a portion of my code in the User Control:
imports myParentPage.ClassName
private Sub Page_load() 'omitted for brevity
dim frmLoad as myParentPage.ClassName = New MyParentPage.ClassName
frmLoad.MyLiteralControl.text = FunctionThatBuildsJavaScript()
end sub
Anyhelp is Greatly Appreciated
Thanks
Elizabeth Harmon Guest
-
how to access user web control from parent page?
Hi, I've created a user web control with 4 drop down list boxes in it. I've added this user control to my main web form page. I created the... -
putting a DataGrid Item in a web user control into Editmode from the parent page.
Hello I am trying to put a Datagrid which is in a web user control into edit mode from the parent page. Basically I am doing this... in... -
Setting Properties on a user control on from the Parent Page
"Eric Elliston" <eelliston@neighborhoodamerica.com> wrote in message news:OiPSIL2ZDHA.1492@TK2MSFTNGP12.phx.gbl... All and control end the -
user control making changes to host page
After you add the user control, look into the Page.FindControls method. The UserControl has a reference to the page it is on through Page. HTH,... -
Access properties of parent page from user control
I am trying to build a control that can only be used on a page that inherits from a custom class. This base class as a series of public...



Reply With Quote

