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