I have a modal window that loads a dynamic user control when the page is loaded. I am having trouble using the javascript getelementbyid to find the textboxes and labels on the dynamic user control. This is what I have so far:
This is the page in the modal window that loads the user control dynamically.
In the page load of the User control I am trying to find the elementbyid and fill the values. ModalUserControl is the name of the user control that I am loading dynamically into the window.
Any help would be greatly appreciated. Thanks in advance.
-Eric
This is the page in the modal window that loads the user control dynamically.
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load |
| Dim modalusercontrol As Control = LoadControl("~/ModalUserControl.ascx") |
| modalusercontrol.ID = "modalusercontrol" |
| Ph1.Controls.Add(modalusercontrol) |
| End Sub |
In the page load of the User control I am trying to find the elementbyid and fill the values. ModalUserControl is the name of the user control that I am loading dynamically into the window.
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| Dim updateParentScript As String = "function ConfigureDialog() { " & _ |
| "var oWindow = GetRadWindow(); " & _ |
| "var oArg = oWindow.Argument; " & _ |
| "var oArea = document.getElementById('<%= (ModalUserControl.FindControl(""NewNameArea"")).ClientID %>').value; " & _ |
| "oArea.value = oArg.NameValue; " & _ |
| "var oArea = document.getElementById('<%= (ModalUserControl.FindControl(""NewProfessionArea"")).ClientID %>').value; " & _ |
| "oArea.value = oArg.ProfessionValue; " & _ |
| "var oArea = document.getElementById('<%= (ModalUserControl.FindControl(""NewLabelArea"")).ClientID %>').value; " & _ |
| "oArea.value = oArg.LabelValue; " & _ |
| "radWindow.Argument = arg;" & _ |
| "}" |
| Page.ClientScript.RegisterStartupScript(Me.[GetType](), "oWindow", updateParentScript, True) |
| Form1.Attributes.Add("onload", "ConfigureDialog()") |
| End Sub |
Any help would be greatly appreciated. Thanks in advance.
-Eric
