Link to home
Start Free TrialLog in
Avatar of eddyperu
eddyperuFlag for United States of America

asked on

How can I call one of the Control ID's that live inside of a Web user Control?

Hi Experts
I have this Line in my aspx page ,which belong to an animated extender:
 <ajaxToolkit:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="??????"  ...

Also, I have a Web user Control that contain an ImageButton control with this ID="create".

How can I call the ID of this ImageButton and set it up as the TargetControlID from the animation extender in my aspx page?
In other words..How can I make that the program read this:

 <ajaxToolkit:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="create" ....

Thanks
This is my page.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MadalPoppUpExtenderExample.aspx.cs"
    Inherits="MadalPoppUpExtenderExample" %>
<%@ Register Src="controls/CreateProfile.ascx" TagName="CreateProfile" TagPrefix="uc1" %>    
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
 
 
</head>
<body class="hola">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"/>
        <table border="1" width="450px" height="580px" align="left">
            <tr>
                <td>    
                <uc1:CreateProfile ID="CreateProfile" runat="server"></uc1:CreateProfile>              
                    <asp:HyperLink runat="server"
                              ID="ClickMe" Text="Click Me" NavigateUrl="#">
                    </asp:HyperLink>
                    <asp:label runat="server" ID="label1" Text="hollaaa"/>
                    <asp:Panel runat="server" ID="MyPopup" CssClass="modalPopup" Style="display: none; width: 240px">
                        <table bgcolor="blue">
                            <tr>
                              <td>This is a test</td>
                            </tr>
                            <tr>
                                <td> 
                                    <asp:TextBox runat="server" ID="Test"/>
                                    <asp:TextBox runat="server" ID="Test2"/>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <br />
                    <asp:Button ID="mockPopupTrigger" runat="server" Text="Button" Style="display: none" />
                    <ajaxToolkit:ModalPopupExtender
                        ID="ModalPopupExtender" runat="server" 
                        TargetControlID="mockPopupTrigger" 
                        PopupControlID="MyPopup"
                        DropShadow="true"
                        BackgroundCssClass="modalBackground"                          
                        BehaviorID="modalBehavior">
                    </ajaxToolkit:ModalPopupExtender>
               
 
                    <script type="text/javascript" language="javascript">// Move an element directly on top of another element (and optionally// make it the same size)
                           function Cover(bottom, top, ignoreSize)
                            {
                              var location = Sys.UI.DomElement.getLocation(bottom);
                              top.style.position = 'absolute';
                              top.style.top = location.y + 'px';
                              top.style.left = location.x + 'px';
                              if (!ignoreSize)
                               {
                                  top.style.height = bottom.offsetHeight + 'px';
                                  top.style.width = bottom.offsetWidth + 'px';
                               }
                            }
                            
 
                    </script>
 
                    
                    <div id="flyout" style="display: none; overflow: hidden; z-index: 2; background-color: green;
                        border: solid 1px red;">
                    </div>
                    <ajaxToolkit:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="????">
                                      
                        <Animations>
                        <OnClick>
                          <Sequence>
                          
                             <%-- Position the wire frame on top of the button and show it --%>
                                <ScriptAction Script="$find('modalBehavior').hide()" />
                                <ScriptAction Script="Cover($get('create'), $get('flyout'));" />
                                <StyleAction AnimationTarget="flyout" Attribute="display" Value="block"/> 
                            <%-- Move the wire frame from the button's bounds to the info panel's bounds --%>  
 
                           <Parallel AnimationTarget="flyout" Duration=".3" Fps="25">
                              <Move Horizontal="300" Vertical="350" />
                              <Resize Width="260" Height="280" />
                              <Color PropertyKey="backgroundColor" StartValue="#ffffff" EndValue="#ffffff" />
                           </Parallel>
                           <ScriptAction Script="$find('modalBehavior').show()"/> 
                           <%-- Move the info panel on top of the wire frame, fade it in, and hide the frame --%>
                           <StyleAction AnimationTarget="flyout" Attribute="display" Value="none"/>
                         </Sequence>
                      </OnClick>
                      </Animations>
                    </ajaxToolkit:AnimationExtender>
                </td>
            </tr>
        </table>
    </form>
</body>
 
 
 
 
 
This is my web User Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CreateProfile.ascx.cs" Inherits="controls_CreateProfile" %>
<table border="1"  bordercolor=red cellpadding="0" cellspacing="0">
  <tr>
    <td>
        <asp:ImageButton ID="create"  ImageUrl="~/images/CreateProfile.png" runat="server" 
        />
    </td>
    </tr>
    <tr>
    <td>
     <asp:ImageButton ID="return"  ImageUrl="~/images/BacktoBcWebsite_On.png" runat="server" />
    </td>
  </tr>
   <tr>
     <td>
     <asp:ImageButton ID="ImageButton1"  ImageUrl="~/images/BackToBC.png" runat="server" />
     </td>
   </tr>
</table>

Open in new window

Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

I don't think you can directly... at least without some major hack job.

Instead, just set the TargetControlID to your user control itself, then, add an event that is raised when the button inside the user control is clicked or whatever particular action you're waiting for.
ASKER CERTIFIED SOLUTION
Avatar of eddyperu
eddyperu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial