<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Simon Steed&#039;s Blog About Stuff! &#187; contentplaceholder</title>
	<atom:link href="http://blog.xploiter.com/tag/contentplaceholder/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xploiter.com</link>
	<description>i.e. anything interesting...</description>
	<lastBuildDate>Wed, 01 Sep 2010 11:15:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4311</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Preparing an asp.net master page for print only view &#8211; stripping out css etc</title>
		<link>http://blog.xploiter.com/c-and-aspnet/preparing-aspnet-master-page-print-view-stripping-css/</link>
		<comments>http://blog.xploiter.com/c-and-aspnet/preparing-aspnet-master-page-print-view-stripping-css/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 08:49:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C# and ASP.Net]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[contentplaceholder]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[hiding]]></category>
		<category><![CDATA[master pages]]></category>

		<guid isPermaLink="false">http://blog.xploiter.com/?p=295</guid>
		<description><![CDATA[Searching google turned up nothing on this so did some digging in MSDN and worked out a method of disabling all the style sheets, javascript etc to produce a text only page: 1/ Add a content block to your master page &#8211; i&#8217;ve called mine &#8216;cssContentHolder&#8217; &#60;asp:contentplaceholder id=&#8221;cssContentHolder&#8221; runat=&#8221;server&#8221;&#62; &#60;link rel=&#8221;stylesheet&#8221; href=&#8221;css/master.css&#8221; type=&#8221;text/css&#8221; media=&#8221;all&#8221; /&#62;]]></description>
			<content:encoded><![CDATA[<p>Searching google turned up nothing on this so did some digging in MSDN and worked out a method of disabling all the style sheets, javascript etc to produce a text only page:</p>
<p>1/ Add a content block to your master page &#8211; i&#8217;ve called mine &#8216;cssContentHolder&#8217;</p>
<p>&lt;asp:contentplaceholder id=&#8221;cssContentHolder&#8221; runat=&#8221;server&#8221;&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;css/master.css&#8221; type=&#8221;text/css&#8221; media=&#8221;all&#8221; /&gt;<br />
&lt;link href=&#8221;css/flyout.css&#8221; media=&#8221;screen&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; /&gt;<br />
&lt;script src=&#8221;scripts/APIs/JQuery/JQuery-1.3.2.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;scripts/APIs/JQuery/Plugins/jquery-ui-1.7.1.custom.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;/asp:contentplaceholder&gt;</p>
<p>2/ In the markup, add a link button so the user can click it to remove the formatting</p>
<p>&lt;asp:LinkButton  PostBackUrl=&#8221;#&#8221; ID=&#8221;textLink&#8221;  runat=&#8221;server&#8221; Text=&#8221;Text Only Version&#8221; onclick=&#8221;textLink_Click&#8221; &gt;&lt;/asp:LinkButton&gt;</p>
<p>3/ In the code behind, create an event handler for the button and add the following code</p>
<p>protected void textLink_Click(object sender, EventArgs e)<br />
{<br />
bool Hidden = Page.Master.FindControl(&#8220;cssContentHolder&#8221;).Visible ;<br />
Page.Master.FindControl(&#8220;cssContentHolder&#8221;).Visible = !Hidden;<br />
if (Hidden)<br />
textLink.Text = &#8220;Switch to Graphical Version&#8221;;<br />
else<br />
textLink.Text = &#8220;Text Only Version&#8221;;<br />
}</p>
<p>That&#8217;s it. When you click on the link, you will perform a postback to the server, get the state of the control and show/hide accordingly. It will also change the text so you can click back again.</p>
<p>Simple when you know how!</p>
<p>Using Javascript, another method to remove all the CSS but not update any link text etc is to call the following function:</p>
<pre id="line1">function hideCSS(){
	if(document.getElementsByTagName){
		for(n=0;n&lt;document.getElementsByTagName("link").length;n++){
			if(document.getElementsByTagName("link")[n].getAttribute){
				if(document.getElementsByTagName("link")[n].getAttribute("rel").indexOf("stylesheet")!=-1){
					document.getElementsByTagName("link")[n].disabled="disabled"
					}
				}
			}
		}
	}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.xploiter.com/c-and-aspnet/preparing-aspnet-master-page-print-view-stripping-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
