469,578 Members | 1,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

How to I use the same ModalPopupExtender in different WebUserControl?

In a web page,” Default.aspx”, I have two different WebUserControl,” WebUserControl1_1”, and “WebUserControl2_1” and a ModalPopupExtender,” ModalPopupExtender1” and a Button,” Button1” and a Panel,” Panel1”. When I click the Button1, the Panel1 will pop up.

WebUserControl1_1 and WebUserControl2_1 both have a LinkButton,” LinkButton1”. I wish when user click the LinkButton1 in the WebUserControl1_1 and WebUserControl2_1, the Panel1 in the Default.aspx will pop up.

Does anyone know how to do that?
Many thanks for replying.
Any suggestion is welcome.

Following is my codes.

Default.aspx
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="AJAXEnabledWebApplication11._Default" %>
  2.  
  3. <%@ Register Src="WebUserControl1.ascx" TagName="WebUserControl1" TagPrefix="uc1" %>
  4. <%@ Register Src="WebUserControl2.ascx" TagName="WebUserControl2" TagPrefix="uc2" %>
  5. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <head runat="server">
  9.     <title>Untitled Page</title>
  10. </head>
  11. <body>
  12.     <form id="form1" runat="server">
  13.         <asp:ScriptManager ID="ScriptManager1" runat="server" />
  14.         <div>
  15.             <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1"
  16.                 PopupControlID="Panel1">
  17.             </cc1:ModalPopupExtender>
  18.             <asp:Button ID="Button1" runat="server" Text="Button" /></div>
  19.         <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
  20.             This is a test.</asp:Panel>
  21.         <uc1:WebUserControl1 ID="WebUserControl1_1" runat="server" />
  22.         <br />
  23.         <uc2:WebUserControl2 ID="WebUserControl2_1" runat="server" />
  24.     </form>
  25. </body>
  26. </html>
WebUserControl1.ascx
Expand|Select|Wrap|Line Numbers
  1. <%@ Control Language="C#" AutoEventWireup="true" Codebehind="WebUserControl1.ascx.cs"
  2.     Inherits="AJAXEnabledWebApplication11.WebUserControl1" %>
  3. <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  4.     Namespace="System.Web.UI" TagPrefix="asp" %>
  5. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  6.     <ContentTemplate>
  7.         <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
  8.     </ContentTemplate>
  9. </asp:UpdatePanel>
WebUserControl2.ascx
Expand|Select|Wrap|Line Numbers
  1. <%@ Control Language="C#" AutoEventWireup="true" Codebehind="WebUserControl2.ascx.cs"
  2.     Inherits="AJAXEnabledWebApplication11.WebUserControl2" %>
  3. <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  4.     Namespace="System.Web.UI" TagPrefix="asp" %>
  5. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  6.     <ContentTemplate>
  7.         <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
  8.     </ContentTemplate>
  9. </asp:UpdatePanel>
Oct 31 '07 #1
0 2951

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by suzi167 | last post: by
reply views Thread by =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post: by
1 post views Thread by Victor | last post: by
reply views Thread by SD | last post: by
reply views Thread by Heron | last post: by
2 posts views Thread by Peter | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.