Excellent workaround Greg!
I convered your codebehind to C# to test and it works for me.. here is my conversion:
protected void Page_Load(object sender, EventArgs e)
{
String s = "{ window.setTimeout(\"$find('ModalPopup').show();\",0); }";
ScriptManager.RegisterStartupScript(Page, typeof (Page), "openModalPopup", s, true);
}
protected void ModalButton_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
}
-Steve
SamuraiProgrammer:
Hi All -
If anyone wants a solution, this will work.
For the HTML posted previously:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="ModalUpdate" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:Button ID="ModalButton" runat="server" Text="Click Me" OnClick="ModalButton_Click" />
<asp:LinkButton id="FakeControl" runat="server"/>
<asp:Panel ID="ModalPanel" runat="server" height="100px" Width="200px" style="display: none">
<div style="text-align: center">Modal Test Panel</div>
<br />
<asp:LinkButton ID="ModalClose" runat="server" Text="Close Window"/>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" CancelControlID="ModalClose"
PopupControlID="ModalPanel" TargetControlID="FakeControl" runat="server"
BehaviorID="ModalPopup" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
The only additional attribute is the "BehaviorID" on the ModalPopupExtender (see above).
And then, in your code behind, instead of:
Protected Sub ModalButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Me.ModalPopupExtender1.Show()
End Sub
You put the following:
Protected Sub ModalButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' Javascript broken out into separate function
Me.OpenModalPopup()
End Sub
Private Sub OpenModalPopup()
Dim retString As New System.Text.StringBuilder()
With retString
.Append("{ ")
.Append(" window.setTimeout(""$find('ModalPopup').show();"",0); ")
.Append("}")
End With
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "openModalPopup", retString.ToString, True)
End Sub
That will work in both firefox 2.0.0.1 and 1.5.0.10 and all versions of IE.
Ping me if you have any questions.
Thanks,
Greg