Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 22nd, 2009, 12:56 AM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default 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..
  #2 (permalink)  
Old January 22nd, 2009, 03:35 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old January 22nd, 2009, 03:57 AM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default

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.

Code:
<
Code:
divid="sidebartop">
 
<asp:ButtonID="Button1"runat="server"Text="Button"onClientClick="return false;"/>
<divclass="sidebartitle"><imgsrc="http://p2p.wrox.com/images/st_recentprojects.gif"/></div>
<divclass="portfoliothumb"><mb:RollOverLinkID="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:09 AM..
  #4 (permalink)  
Old January 22nd, 2009, 03:59 AM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default

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..
  #5 (permalink)  
Old January 22nd, 2009, 04:01 AM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default

Why is it cutting out the spaces when I paste code from VS2008?
  #6 (permalink)  
Old January 22nd, 2009, 04:02 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #7 (permalink)  
Old January 22nd, 2009, 04:04 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

It's a bug in this forum. Use the Code block from the toolbar and it'll work OK...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #8 (permalink)  
Old January 22nd, 2009, 04:15 AM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default

If you look at the first post, I added a line break where the button1 control is.

Thanks,
J.
  #9 (permalink)  
Old January 22nd, 2009, 04:23 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #10 (permalink)  
Old January 22nd, 2009, 01:20 PM
Authorized User
 
Join Date: Sep 2003
Location: Orange County, CA, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to julianfraser Send a message via MSN to julianfraser Send a message via Yahoo to julianfraser
Default

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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing parent page from modal dialog gp_mk HTML Code Clinic 25 April 19th, 2007 01:28 PM
resizing the contentplaceholder in the master page ersdhivya ASP.NET 2.0 Basics 1 October 31st, 2006 09:26 AM
Referencing Fields within Tab Control Pages -Help TomW Access VBA 1 October 30th, 2006 01:31 PM
Referencing a user control properties trekmp General .NET 2 April 7th, 2004 08:40 AM



All times are GMT -4. The time now is 09:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.