On my ASP.NET page I have a button. After click on the server side should be generate a div which represent the content for a jQuery dialog and the related JavaScript block. But neither the div nor the JavaScript are contained on the page after the button click. Is it too late to register controls and scripts at the click or why doesn't work?
'create JavaScript block
Dim strClientScript As String = String.Empty
Dim strMessageControlId As String = "jQueryDialog" & Me.MyContainer.Controls.Count
strClientScript &= "$(function(){" & NewLine
strClientScript &= " $(""#" & strMessageControlId & """).dialog({" & NewLine
strClientScript &= " bgiframe:true, " & NewLine
strClientScript &= " autoOpen:true, " & NewLine
strClientScript &= " modal:true, " & NewLine
strClientScript &= " closeOnEscape:false, " & NewLine
strClientScript &= " width:600, " & NewLine
strClientScript &= " height:450 " & NewLine
strClientScript &= " });" & NewLine
strClientScript &= "});"
'create div for the jQuery Dialog
Dim strHtml As String = String.Empty
strHtml &= "<div id=""" & strMessageControlId & """ title=""My title"">" & NewLine
strHtml &= strMessage & NewLine
strHtml &= "</div>"
'add the HTML to the page
Me.MyContainer.Controls.Add(New LiteralControl(strHtml))
'register the Javascript
Me.Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "Key." & strMessageControlId, strClientScript, True)