Hello,
I'm looking for some help with using the rad ajax panel and the Ajax control Toolkit - modal popup extender on the same page.
I need the whole page to be ajax enabled, i also need to be able to show the modal popup extender from code behind. If i place the modal popup in the ajax panel, the line in code behind that calls the PopupExtender1.Show() does nothing.
However, if i move the extender out of the ajax panel, i get errors in the javascript saying the page cannot have two components with the same id. this is referring to the popup extender and occurs whenever something causes a partial postback in the ajax panel.
Could anyone explain why this is happening or whether i can fix it?
I have included a sample ap that describes the behavior above. I also have the latest ajax version.
Default.aspx
| <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| |
| <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> |
| <%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title>Untitled Page</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server" /> |
| <div> <radA:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px" |
| EnableAJAX="true" EnableOutsideScripts="true"> |
| <asp:UpdatePanel ID="UpdatePanel3" runat="server"> |
| <ContentTemplate> |
| <asp:Panel ID="Panel1" runat="server" Style="display: none" Width="700" Height="300"> |
| loaded |
| <asp:Button ID="Button2" runat="server" Text="Close" OnClick="Button2_Click" /> |
| </asp:Panel> |
| <cc1:ModalPopupExtender ID="PopupExtender1" runat="server" PopupControlID="Panel1" |
| TargetControlID="hiddenPublishButton" OkControlID="btnMFinish" |
| CancelControlID="btnMClose"> |
| </cc1:ModalPopupExtender> |
| <asp:Button ID="btnMClose" runat="server" Style="visibility: hidden" /> |
| <asp:Button ID="btnMFinish" runat="server" Style="visibility: hidden" /> |
| <asp:Button ID="hiddenPublishButton" runat="server" Text="" Style="display: none" /> |
| <asp:LinkButton ID="lb_publish" runat="server" OnClick="lb_publish_Click">Show</asp:LinkButton> |
| </ContentTemplate> |
| <Triggers> |
| <asp:AsyncPostBackTrigger ControlID="lb_publish" EventName="Click" /> |
| </Triggers> |
| </asp:UpdatePanel> |
| |
| <asp:Button ID="Button1" runat="server" Text="Button" /><asp:TextBox ID="TextBox1" |
| runat="server"></asp:TextBox> |
| </radA:RadAjaxPanel> |
| </div> |
| </form> |
| </body> |
| </html> |
Default.aspx.vb
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| |
| Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) |
| PopupExtender1.Hide() |
| End Sub |
| |
| Protected Sub lb_publish_Click(ByVal sender As Object, ByVal e As System.EventArgs) |
| PopupExtender1.Show() |
| End Sub |
| Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click |
| TextBox1.Text = Now.Date.ToString |
| End Sub |
| End Class |