Innovation. Imagination. Delivered. RSS 2.0
# Wednesday, June 24, 2009
One of the things we frequently see when a client-project uses masterpages is the following type-cast:

MasterPageType myMasterPage = Page.Master as MasterPageType;

To avoid this type-cast you can simply add the following directive to your page:

<%@ MasterType VirtualPath="~/Site.master" %>

Adding this directive to your page will make the Master property strongly-typed (Page.Master remains loosely-typed) to your masterpage eliminating the need to do the aforementioned type-cast.

Wednesday, June 24, 2009 10:20:03 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] - Trackback
Coding Tips
Archive
<June 2009>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Christopher L Price
Sign In
Statistics
Total Posts: 13
This Year: 0
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2012, Christopher L Price
DasBlog theme 'Business' created by Christoph De Baene (delarou)