 |
| ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 22nd, 2009, 12:56 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Referencing a control within a different ContentPlaceHolder on same page
Hi I have a masterpage containing 2 contentplaceholders. In my default.aspx page I'm trying to reference controls within one of the contentplaceholders from and animationextender in the other. Can't seen to make this happen for some reason.
Here's the sample code from default.aspx...
Code:
<%@Page Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
<%@Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@Register Assembly="MetaBuilders.WebControls" Namespace="MetaBuilders.WebControls" TagPrefix="mb" %>
<asp:Content ID="head" ContentPlaceHolderID="cpHead" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cpMainContent" Runat="Server">
<divid="flyout" style="position:absolute;left:0px;top:0px;text-align:center;z-index:10;">
<asp:Image ID="flyoutImg" runat="server" Visible="False"/>
<br/>
<asp:HyperLinkID="flyoutClose" runat="server" Text="close" NavigateUrl="#" onClientClick="return false;"
ToolTip="Click to close this popup" Visible="False"></asp:HyperLink>
</div>
<div id="maintop"><img src="http://p2p.wrox.com/images/tt_home.gif"/>
</div>
<div id="pagecontent">
<div class="pagecontent2col"><p></p></div>
<div class="pagecontent2col"><p></p>
<p></p></div>
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpSideBar" Runat="Server">
<cc1:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="Button1">
<Animations>
<OnClick>
<Sequence>
<EnableAction Enabled="False"/>
<HideAction Target="flyoutImg" Visible="true"/>
<HideAction Target="flyoutClose" Visible="true"/>
</Sequence>
</OnClick>
</Animations>
</cc1:AnimationExtender>
<div id="sidebartop">
<asp:Button ID="Button1" runat="server" Text="Button" onClientClick="return false;"/>
<div class="sidebartitle"><img src="http://p2p.wrox.com/images/st_recentprojects.gif"/></div>
<div class="portfoliothumb"><mb:RollOverLink ID="recentProject1" runat="server"
ImageUrl=http://p2p.wrox.com/images/portfolio...arkatsigns.jpg
RollOverImageUrl=http://p2p.wrox.com/images/portfolio...rkatsigns2.jpg
onClientClick="return false;"></mb:RollOverLink></div>
</div>
<divid="sidebarbottom"></div>
</asp:Content>
Last edited by julianfraser; January 22nd, 2009 at 04:08 AM..
|
|

January 22nd, 2009, 03:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I don't see Button1 defined in the other Content block at all...
BTW: when you post code in our message, can you please add a line break here and there? Makes it a lot easier to read...
Imar
|
|

January 22nd, 2009, 03:57 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It's there. Not sure where you'd like me to put line breaks for you. I could make the code more readable if this would let me put in tabs.
Last edited by julianfraser; January 22nd, 2009 at 04:09 AM..
|
|

January 22nd, 2009, 03:59 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I see what you mean... the code block seems to take out all spaces in the code.
<div id="sidebartop">
<asp:Button ID="Button1" runat="server" Text="Button" onClientClick="return false;"/> <div class="sidebartitle"><imgsrc="http://p2p.wrox.com/images/st_recentprojects.gif"/></div>
<div class="portfoliothumb"><mb:RollOverLink ID="recentProject1" runat="server"
ImageUrl=http://p2p.wrox.com/images/portfolio...arkatsigns.jpg
RollOverImageUrl=http://p2p.wrox.com/images/portfolio...rkatsigns2.jpg onClientClick="return false;"></mb:RollOverLink></div>
</div>
Last edited by julianfraser; January 22nd, 2009 at 04:13 AM..
|
|

January 22nd, 2009, 04:01 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Why is it cutting out the spaces when I paste code from VS2008?
|
|

January 22nd, 2009, 04:02 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It does let you put in tabs if you format it s code using the Code button on the toolbar....
You can add line breaks in long lines of code so they wrap over multiple lines.
Where is this Button1 located? Earlier you said you tried to reference that Button from one Content block in another, but I didn't see it in the original code you posted...
Imar
|
|

January 22nd, 2009, 04:04 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It's a bug in this forum. Use the Code block from the toolbar and it'll work OK...
Imar
|
|

January 22nd, 2009, 04:15 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
If you look at the first post, I added a line break where the button1 control is.
Thanks,
J.
|
|

January 22nd, 2009, 04:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
But it's in the same Content block as the extender, isn't it?
Maybe I just don't understand what your problem is exactly. Can you elaborate?
Imar
|
|

January 22nd, 2009, 01:20 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
When I placed the AnimationExtender1 control in the other ContentPlaceHolder, this is the error I get at runtime...
Quote:
|
The TargetControlID of 'AnimationExtender1' is not valid. A control with ID 'Button1' could not be found.
|
So I moved the AnimationExtender1 control to the lower ContentPlaceHolder. The result of this is that the button itself disables on click, but the HideActions in the animation sequence do nothing as they reference controls in the upper ContentPlaceHolder.
Basically, anything I do will only work if it is in the same ContentPlaceHolder. So my question is how to reference objects in a different ContentPlaceHolder.
Thanks,
J.
|
|
 |