www.RickLaFleur.com

 

Setting the property for div in a ContentPlaceHolder

Following shows how to set the property for a div that is in a C#.NET ContentPlaceHolder found with Master Pages:

Step 1; in the aspx file, the div needs a unqiue id and set to runat="server":


<asp:Content ID="conent1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <div id="myDivId" runat="server" style="display: block;">
    <p>foo bar</p>
  </div>
</asp:Content>

Step 2; In the aspx.cs file, the ContentPlaceHolderId is retrieved first using the Page.Master.FindControl and then used to reference the div:

ContentPlaceHolder content = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");
content.FindControl("myDivId").Visible = false;

Labels:


Comments:
[B]NZBsRus.com[/B]
Dont Bother With Crawling Downloads Using NZB Files You Can Quickly Find HD Movies, Games, Music, Applications and Download Them at Accelerated Rates

[URL=http://www.nzbsrus.com][B]Usenet Search[/B][/URL]
 
Post a Comment



Links to this post:

Create a Link



<< Home

Archives

January 2007  |   March 2007  |   May 2007  |   February 2008  |   April 2008  |   July 2008  |   September 2008  |   October 2008  |   December 2008  |   January 2009  |   April 2009  |   May 2009  |   June 2009  |   December 2009  |   January 2010  |  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]