<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Central Florida Software Blog - Coding Tips</title>
    <link>http://www.centralflsoftware.com/blog/</link>
    <description>Innovation. Imagination. Delivered.</description>
    <language>en-us</language>
    <copyright>Christopher L Price</copyright>
    <lastBuildDate>Wed, 24 Jun 2009 14:20:03 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>blog@centralflsoftware.com</managingEditor>
    <webMaster>blog@centralflsoftware.com</webMaster>
    <item>
      <trackback:ping>http://www.centralflsoftware.com/blog/Trackback.aspx?guid=bf884849-ef57-4ade-9bf5-d460a38ffd51</trackback:ping>
      <pingback:server>http://www.centralflsoftware.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.centralflsoftware.com/blog/PermaLink,guid,bf884849-ef57-4ade-9bf5-d460a38ffd51.aspx</pingback:target>
      <dc:creator>Christopher Price</dc:creator>
      <georss:point>28.171599 -82.001953</georss:point>
      <wfw:comment>http://www.centralflsoftware.com/blog/CommentView,guid,bf884849-ef57-4ade-9bf5-d460a38ffd51.aspx</wfw:comment>
      <wfw:commentRss>http://www.centralflsoftware.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bf884849-ef57-4ade-9bf5-d460a38ffd51</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">One of the things we frequently see when
a client-project uses masterpages is the following type-cast:<br /><br /><code> MasterPageType myMasterPage = Page.Master as MasterPageType; </code><br /><br />
To avoid this type-cast you can simply add the following directive to your page:<br /><br /><code> &lt;%@ MasterType VirtualPath="~/Site.master" %&gt; </code><br /><br />
Adding this directive to your page will make the <code>Master</code> property strongly-typed
(<code>Page.Master</code> remains loosely-typed) to your masterpage eliminating the
need to do the aforementioned type-cast.<br /><br /><img width="0" height="0" src="http://www.centralflsoftware.com/blog/aggbug.ashx?id=bf884849-ef57-4ade-9bf5-d460a38ffd51" /></body>
      <title>Coding Tips: Master Pages</title>
      <guid isPermaLink="false">http://www.centralflsoftware.com/blog/PermaLink,guid,bf884849-ef57-4ade-9bf5-d460a38ffd51.aspx</guid>
      <link>http://www.centralflsoftware.com/blog/2009/06/24/CodingTipsMasterPages.aspx</link>
      <pubDate>Wed, 24 Jun 2009 14:20:03 GMT</pubDate>
      <description>One of the things we frequently see when a client-project uses masterpages is the following type-cast:&lt;br&gt;
&lt;br&gt;
&lt;code&gt; MasterPageType myMasterPage = Page.Master as MasterPageType; &lt;/code&gt; 
&lt;br&gt;
&lt;br&gt;
To avoid this type-cast you can simply add the following directive to your page:&lt;br&gt;
&lt;br&gt;
&lt;code&gt; &amp;lt;%@ MasterType VirtualPath="~/Site.master" %&amp;gt; &lt;/code&gt; 
&lt;br&gt;
&lt;br&gt;
Adding this directive to your page will make the &lt;code&gt;Master&lt;/code&gt; property strongly-typed
(&lt;code&gt;Page.Master&lt;/code&gt; remains loosely-typed) to your masterpage eliminating the
need to do the aforementioned type-cast.&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://www.centralflsoftware.com/blog/aggbug.ashx?id=bf884849-ef57-4ade-9bf5-d460a38ffd51" /&gt;</description>
      <comments>http://www.centralflsoftware.com/blog/CommentView,guid,bf884849-ef57-4ade-9bf5-d460a38ffd51.aspx</comments>
      <category>Coding Tips</category>
    </item>
  </channel>
</rss>