<?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>full house</title>
	<atom:link href="http://full-house.cn/feed" rel="self" type="application/rss+xml" />
	<link>http://full-house.cn</link>
	<description>SELECT blog FROM TonyHu.full-house WHERE subject IN (Life,Web,Database)</description>
	<lastBuildDate>Sat, 31 Dec 2011 17:11:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2012 To Do List</title>
		<link>http://full-house.cn/201112/2012-to-do-list.html</link>
		<comments>http://full-house.cn/201112/2012-to-do-list.html#comments</comments>
		<pubDate>Sat, 31 Dec 2011 17:11:55 +0000</pubDate>
		<dc:creator>Tony hu</dc:creator>
				<category><![CDATA[Mylife]]></category>
		<category><![CDATA[Myself]]></category>

		<guid isPermaLink="false">http://full-house.cn/?p=866</guid>
		<description><![CDATA[

反思2011：
 
刚才一直在忙着给爸妈订机票的事，突然窗外响起了鞭炮声，我意识到传说中的2012到来了，过了一会儿小姜给我发了一条祝福短信，又想到了2008年的12月31日寒山寺听钟声的事了，呵呵。到了现在，即使以前是很好的朋友，在一些节假日也不愿意给一个问候，哪怕是一个短信。所以前几天看到这个日志的时候非常有感慨！
经常关注 DBAnotes 的博客，所以从2009起都会写一个小小的计划（2009，2010，2011），哪怕完成不了，也要装模作样地写上。
 
2011年我让老婆从宁波来到苏州，并在苏州安了家；
2011年我们结婚了；
2011年老婆怀孕了，再过半年，我就要做爸爸了；
 
展望2012：

迎接孩子出生，照顾好老婆。
努力多赚钱，为孩子创造良好的环境。
一定要健身，我现在150啦，可以想像吗？
和朋友、爸妈多沟通，多交流。

好了，老婆早就睡觉了，我今年就写这么多了，明天早上我给所有的好友群发短信，使用106号段发，大家不要感到意外。
2012 我们来了&#8230;


]]></description>
			<content:encoded><![CDATA[<div id="blogDetailDiv">
<div>
<div><strong>反思2011：</strong></div>
<div> </div>
<div>刚才一直在忙着给爸妈订机票的事，突然窗外响起了鞭炮声，我意识到传说中的2012到来了，过了一会儿小姜给我发了一条祝福短信，又想到了<a  href="http://user.qzone.qq.com/359898601/blog/1230748299" target="_blank">2008年的12月31日寒山寺听钟声的事了</a>，呵呵。到了现在，即使以前是很好的朋友，在一些节假日也不愿意给一个问候，哪怕是一个短信。所以前几天看到<a  href="http://user.qzone.qq.com/359898601/blog/1325210831" target="_blank">这个日志</a>的时候非常有感慨！</div>
<div>经常关注 <a  href="http://www.dbanotes.net/" target="_blank">DBAnotes</a> 的博客，所以从2009起都会写一个小小的计划（<a  href="http://full-house.cn/200907/2009-to-do-list.html" target="_blank">2009</a>，<a  href="http://full-house.cn/200912/2010-to-do-list.html" target="_blank">2010</a>，<a  href="http://full-house.cn/201012/2011-to-do-list.html" target="_blank">2011</a>），哪怕完成不了，也要装模作样地写上。</div>
<div> </div>
<div>2011年我让老婆从宁波来到苏州，并在苏州安了家；</div>
<div>2011年我们结婚了；</div>
<div>2011年老婆怀孕了，再过半年，我就要做爸爸了；</div>
<div> </div>
<div><strong>展望2012：</strong></div>
<ol>
<li>迎接孩子出生，照顾好老婆。</li>
<li>努力多赚钱，为孩子创造良好的环境。</li>
<li>一定要健身，我现在150啦，可以想像吗？</li>
<li>和朋友、爸妈多沟通，多交流。</li>
</ol>
<p>好了，老婆早就睡觉了，我今年就写这么多了，明天早上我给所有的好友群发短信，使用106号段发，大家不要感到意外。</p>
<p>2012 我们来了&#8230;</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://full-house.cn/201112/2012-to-do-list.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2011-11-26 @ 松鹤楼</title>
		<link>http://full-house.cn/201111/song-he-lou.html</link>
		<comments>http://full-house.cn/201111/song-he-lou.html#comments</comments>
		<pubDate>Thu, 03 Nov 2011 10:29:53 +0000</pubDate>
		<dc:creator>Tony hu</dc:creator>
				<category><![CDATA[Myself]]></category>

		<guid isPermaLink="false">http://full-house.cn/?p=864</guid>
		<description><![CDATA[我们婚宴第一站——苏州。我们准备了四个包厢，应该够了，希望朋友都能过来啊。
]]></description>
			<content:encoded><![CDATA[<p>我们婚宴第一站——苏州。我们准备了四个包厢，应该够了，希望朋友都能过来啊。</p>
]]></content:encoded>
			<wfw:commentRss>http://full-house.cn/201111/song-he-lou.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我要做爸爸啦</title>
		<link>http://full-house.cn/201110/i-will-be-a-father.html</link>
		<comments>http://full-house.cn/201110/i-will-be-a-father.html#comments</comments>
		<pubDate>Sat, 08 Oct 2011 16:51:42 +0000</pubDate>
		<dc:creator>Tony hu</dc:creator>
				<category><![CDATA[Myself]]></category>

		<guid isPermaLink="false">http://full-house.cn/?p=862</guid>
		<description><![CDATA[今天去医院检查了，老婆怀孕了，我再过9个月就要做爸爸啦，呵呵，肩上的责任更大啦，加油。
]]></description>
			<content:encoded><![CDATA[<p>今天去医院检查了，老婆怀孕了，我再过9个月就要做爸爸啦，呵呵，肩上的责任更大啦，加油。</p>
]]></content:encoded>
			<wfw:commentRss>http://full-house.cn/201110/i-will-be-a-father.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>结婚证</title>
		<link>http://full-house.cn/201109/wedding.html</link>
		<comments>http://full-house.cn/201109/wedding.html#comments</comments>
		<pubDate>Fri, 16 Sep 2011 02:30:15 +0000</pubDate>
		<dc:creator>Tony hu</dc:creator>
				<category><![CDATA[Mylife]]></category>

		<guid isPermaLink="false">http://full-house.cn/?p=858</guid>
		<description><![CDATA[2011年9月14日，我和她领证成功，愉快奔向已婚生活。
]]></description>
			<content:encoded><![CDATA[<p>2011年9月14日，我和她领证成功，愉快奔向已婚生活。</p>
]]></content:encoded>
			<wfw:commentRss>http://full-house.cn/201109/wedding.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asp.net中MasterPage的使用</title>
		<link>http://full-house.cn/201106/asp-net-masterpage.html</link>
		<comments>http://full-house.cn/201106/asp-net-masterpage.html#comments</comments>
		<pubDate>Sat, 04 Jun 2011 09:47:23 +0000</pubDate>
		<dc:creator>Tony hu</dc:creator>
				<category><![CDATA[ASP.net]]></category>

		<guid isPermaLink="false">http://full-house.cn/?p=856</guid>
		<description><![CDATA[
1. 创建 MasterPage，后缀名 .master, 如 x.master.
其中用 &#60;asp:ContentPlaceHolder /&#62; 定义空位。如：
&#60;asp:ContentPlaceHolder ID=&#8221;ContentPlaceHolder1&#8243; Runat=&#8221;Server&#8221;&#62;
&#60;/asp:ContentPlaceHolder&#62;
2. 创建内容页面。
在 NewItem 对话框里选择 &#8220;select master page&#8221;, 选择上一步创建的 MasterPage.
产生的代码里， MasterPageFile 属性指定了 MasterPage 的位置：
&#60;%@ Page Language=&#8221;VB&#8221; MasterPageFile=&#8221;~/x.master&#8221; Title=&#8221;无标题页面&#8221; %&#62;
页面里用 &#60;asp:Content /&#62; 来添加内容到对应的空位：
&#60;asp:Content ID=&#8221;Content1&#8243; ContentPlaceHolderId=&#8221;ContentPlaceHolder1&#8243; Runat=&#8221;Server&#8221;&#62;
内容
&#60;/asp:Content/&#62;
内容页面没有 &#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;
3. 利用 MasterPage 可以使用多种语言来编写一个页面的各个部分。
4. 除了在 &#60;%@ Page %&#62; 里面指定 MasterPage, 也可以在 web.config 指定：
&#60;configuration&#62;
&#60;system.web&#62;
&#60;pages masterPageFile=&#8221;~/x.master&#8221; /&#62;
&#60;/system.web&#62;
&#60;/configuration&#62;
这样定义后，如果创建 Page 时选择了 master page, [...]]]></description>
			<content:encoded><![CDATA[<div id="blog_text">
<p>1. 创建 MasterPage，后缀名 .master, 如 x.master.<br />
其中用 &lt;asp:ContentPlaceHolder /&gt; 定义空位。如：</p>
<p>&lt;asp:ContentPlaceHolder ID=&#8221;ContentPlaceHolder1&#8243; Runat=&#8221;Server&#8221;&gt;<br />
&lt;/asp:ContentPlaceHolder&gt;<br />
2. 创建内容页面。<br />
在 NewItem 对话框里选择 &#8220;select master page&#8221;, 选择上一步创建的 MasterPage.<br />
产生的代码里， MasterPageFile 属性指定了 MasterPage 的位置：</p>
<p>&lt;%@ Page Language=&#8221;VB&#8221; MasterPageFile=&#8221;~/x.master&#8221; Title=&#8221;无标题页面&#8221; %&gt;</p>
<p>页面里用 &lt;asp:Content /&gt; 来添加内容到对应的空位：</p>
<p>&lt;asp:Content ID=&#8221;Content1&#8243; ContentPlaceHolderId=&#8221;ContentPlaceHolder1&#8243; Runat=&#8221;Server&#8221;&gt;<br />
内容<br />
&lt;/asp:Content/&gt;</p>
<p>内容页面没有 &lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;<br />
3. 利用 MasterPage 可以使用多种语言来编写一个页面的各个部分。<br />
4. 除了在 &lt;%@ Page %&gt; 里面指定 MasterPage, 也可以在 web.config 指定：</p>
<p>&lt;configuration&gt;<br />
&lt;system.web&gt;<br />
&lt;pages masterPageFile=&#8221;~/x.master&#8221; /&gt;<br />
&lt;/system.web&gt;<br />
&lt;/configuration&gt;</p>
<p>这样定义后，如果创建 Page 时选择了 master page, 则在 &lt;%@ Page %&gt; 里面不需要指定即可使用该 MasterPage.<br />
其他页面要使用不同的 MasterPage 的话，只要用第一种方法在 Page directive 里面明确的覆盖 web.config 里的设置即可。</p>
<p>可以仅对一组 pages 指定 MasterPage. 下例利用 web.config 的 location 元素，设定了 Admin 目录下的页面采用的不同的 MasterPage.</p>
<p>&lt;configuration&gt;<br />
&lt;location path=&#8221;Admin&#8221;&gt;<br />
&lt;system.web&gt;<br />
&lt;pages masterPageFile=&#8221;~/y.master&#8221; /&gt;<br />
&lt;/system.web&gt;<br />
&lt;/location&gt;<br />
&lt;/configuration&gt;<br />
5. 在内容页面如何设定 Page 的 Title ?</p>
<p>默认情况下，Title 在 MasterPage 中指定后，其他具体页面就都使用这个 Title.<br />
在具体页面，可以有两个办法修改 Title：</p>
<p>a. &lt;%@ Page Title=&#8221;test&#8221; %&gt;</p>
<p>b. 代码中：</p>
<p>protected void Page_LoadComplete(object sender, EventArgs e)<br />
{<br />
Master.Page.Title = &#8220;Hello&#8221;;<br />
}<br />
6. 访问 MasterPage 中的属性和控件。</p>
<p>用 Master 属性来访问。</p>
<p>a. 假设 MasterPage 中有一个 Label1, 那么在内容页面可以这样：</p>
<p>protected void Page_LoadComplete(object sender, EventArgs e)<br />
{<br />
string text = (Master.FindControl(&#8220;Label1&#8243;) as Label).Text;<br />
}</p>
<p>页面加载的次序：</p>
<p>要获取在 MasterPage 的 Page_Load 里面设定的值，必须在内容页面的 Page_LoadComplete 中来写。</p>
<p>前面提到的 FindControl() 方法来查找 MasterPage 中的控件，是一种后期绑定的做法，一般是不安全的。因为这取决于 MasterPage 中是否存在这个 tag，如果被删除了，则会导致错误。<br />
比较好的做法是，在 MasterPage 中用属性封装对他的控件的访问；如果用 FindControl(), 则总是检查其结果是否为 null.<br />
7. 指定 MasterPage 中的默认内容</p>
<p>直接在 &lt;asp:ControlPlaceHolder /&gt; 标签之间指定即可。<br />
如果子页面不重新指定，则会采用该默认内容。<br />
8. 编程的方式指定 Master Page</p>
<p>protected void Page_PreInit(object sender, EventArgs e)<br />
{<br />
Page.MasterPageFile = &#8220;~/x.master&#8221;;<br />
}<br />
9. 嵌套的 Master Page</p>
<p>Master Page 可以继承自更高层次的 Master Page.　但是在 VS2005 中创建这种子 Master Page 的时候，不会有默认的支持。<br />
假设有了一个 A.master，<br />
我们现在先创建一个普通的 B.master，<br />
然后删除其中除了 Page directive 的其他部分。<br />
把 Page Directive 修改为如下，并加入自己要定义的 PlaceHolder：</p>
<p>&lt;%@ Master MasterPageFile=&#8221;~/A.master&#8221; %&gt;</p>
<p>&lt;asp:Content ID=&#8221;Content1&#8243; ContentPlaceHolderID=&#8221;ContentPlaceHolder1&#8243; Runat=&#8221;server&#8221;&gt;<br />
Hello!<br />
&lt;asp:ContentPlaceHolder ID=&#8221;ContentPlaceHolder2&#8243; Runat=&#8221;server&#8221;&gt;<br />
&lt;/asp:ContentPlaceHolder&gt;<br />
&lt;/asp:Content&gt;</p>
<p>用嵌套的模板产生的子页面将不能采用 VS2005 的 design 模式。<br />
10. 容器特定的 Master Pages</p>
<p>为了能兼容不同的浏览器，asp.net 2.0 支持多个 Master Page. 在运行时将自动加载合适的 Master Page.</p>
<p>语法如下：</p>
<p>&lt;%@ Page Language=&#8221;VB&#8221; MasterPageFile=&#8221;~/Abc.master&#8221;<br />
Mozilla:MasterPageFile=&#8221;~/AbcMozilla.master&#8221;<br />
Opera:MasterPageFile=&#8221;~/AbcMozilla.master&#8221; %&gt;<br />
11. 页面请求的次序</p>
<p>当用户请求一个用 Master Page 构建的页面时，各种事件发生的次序如下：</p>
<p>Master Page 子控件初始化；<br />
内容页面子控件初始化；<br />
Master Page 初始化；<br />
内容页面初始化；<br />
内容页面 Page_Load；<br />
Master Page 的 Page_Load；<br />
Master Page 子控件加载；<br />
内容页面子控件加载；<br />
注意点：</p>
<p>因为内容页面的 Page_Load 先于 Master Page 的 Page_Load，所以，如果要访问 Master Page 里的服务器控件，则必须在内容页面的 Page_LoadComplete 方法里书写代码。<br />
12. 使用缓存</p>
<p>只有在内容页面才可以使用如下的 directive 指定缓存：</p>
<p>&lt;%@ OutputCache Duration=&#8221;10&#8243; Varybyparam=&#8221;None&#8221; %&gt;</p>
<p>（这个指令让服务器在内存里缓存该页面 10 秒钟）</p>
<p>如果对 Master Page 指定该指令，本身并不会引发错误。但是当他的子页面下一次来获取其 Master Page 的时候，如果这时 Master Page 已经过期，则会引发一个错误。<br />
所以实际上只能对子页面指定缓存。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://full-house.cn/201106/asp-net-masterpage.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

