<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>tag:blogger.com,1999:blog-2893139382062216061</id><updated>2012-05-14T22:27:29.734+08:00</updated><category term="實用軟體" /><category term="Drupal" /><category term="Blogger設定" /><category term="Access" /><category term="程式語法" /><category term="Joomla" /><category term="Zen Cart" /><category term="SEO優化" /><category term="Linux Ubuntu" /><category term="Excel VBA" /><category term="Asp.Net" /><category term="ECSHOP" /><category term="生活記錄" /><category term="資訊新鮮事" /><category term="電腦疑難雜症" /><category term="Xampp" /><category term="網路管理" /><title type="text">威筆記</title><subtitle type="html">『威筆記』知識累積、經驗分享。分享是知識的累積、分享是加倍的喜悅。熱愛資訊、努力累積自我無形資產</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://tgw1029.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default?start-index=26&amp;max-results=25" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>118</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/tgw1029" /><feedburner:info uri="tgw1029" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-6603930228775773909</id><published>2010-05-09T22:08:00.002+08:00</published><updated>2010-05-09T22:14:40.274+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="網路管理" /><title type="text">ipconfig 指令參數說明</title><content type="html">在Windows命令提示字元中(cmd)，&lt;strong&gt;ipconfig&lt;/strong&gt;是Windows系統的TCP/IP應用程式指令，其用途為顯示本機電腦的&lt;strong&gt;IP位址&lt;/strong&gt;與相關配置資訊。&lt;strong&gt;ipconfig&lt;/strong&gt;對於網路的故障排除有著重要的作用，其參數指令直覺且易用。&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;語法：&lt;/span&gt;&lt;br /&gt;ipconfig&amp;nbsp; [/參數]&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #ff8000;"&gt;參數說明：&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;/all&lt;/strong&gt;&lt;br /&gt;顯示網路卡的TCP/IP所有完整配置資訊。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/renew &lt;/strong&gt;&lt;strong&gt;[adapter]&lt;/strong&gt;&lt;br /&gt;用於需重新配置DHCP的網路卡。(此參數只可用於設定為自動DHCP配置IP位址的環境下)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/release &lt;strong&gt;[adapter]&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;要求DHCP釋放(丟棄)網路卡的IP位址。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/displaydns&lt;/strong&gt;&lt;br /&gt;顯示DNS快取內容。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/flushdns&lt;/strong&gt;&lt;br /&gt;重新刷新清理DNS快取。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/registerdns&lt;/strong&gt;&lt;br /&gt;重新註冊(初始化)IP位址與DNS名稱。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/showclassid &lt;strong&gt;[adapter]&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;顯示網路卡的DHCP類別ID。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/setclassid &lt;strong&gt;[adapter]&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;配置網路卡的DHCP類別ID。&lt;/li&gt;&lt;li&gt;&lt;strong&gt;/?&lt;/strong&gt;&lt;br /&gt;顯示ipconfig的參數說明。&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-6603930228775773909?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/L7ylxX8FeIXM9pj-Tp1JGIw7yAo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L7ylxX8FeIXM9pj-Tp1JGIw7yAo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/L7ylxX8FeIXM9pj-Tp1JGIw7yAo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L7ylxX8FeIXM9pj-Tp1JGIw7yAo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/_i6D-lbdwBE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/6603930228775773909/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/05/ipconfig.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6603930228775773909" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6603930228775773909" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/_i6D-lbdwBE/ipconfig.html" title="ipconfig 指令參數說明" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/05/ipconfig.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-191091073685822141</id><published>2010-05-03T21:57:00.001+08:00</published><updated>2010-05-03T21:58:54.359+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">讓Chrome瀏覽器支援MaintainScrollPositionOnPostback屬性</title><content type="html">&lt;p&gt;&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.page.maintainscrollpositiononpostback%28VS.80%29.aspx" target="_blank"&gt;&lt;strong&gt;MaintainScrollPositionOnPostback&lt;/strong&gt;&lt;/a&gt;主要功能是在Asp.Net的Page中取得或設定值，指出在回傳後是否將使用者返回用戶端瀏覽器中的相同位置。簡單的說就是讓頁面在PostBack後還能保持頁面位置。&lt;br&gt;&lt;br&gt;即使我們在Page中設定了MaintainScrollPositionOnPostback為True，但在最近市佔率越來越高的&lt;a href="http://www.google.com/chrome/index.html?hl=zh-TW&amp;amp;brand=CHMA&amp;amp;utm_campaign=zh_hk&amp;amp;utm_source=zh-TW-ha-apac-tw-bk&amp;amp;utm_medium=ha" target="_blank"&gt;Chrome&lt;/a&gt;這個&lt;strong&gt;&lt;/strong&gt;以速度快著名的Goolge瀏覽器卻是失效了。&lt;br&gt;&lt;br&gt;自己在遇這個問題後，在Google找到此站提供的方式解決了我的問題：&lt;br&gt;&lt;a href="http://blog.uni2.tw/post/2009/07/17/e8ae93Chromee7808fe8a6bde599a8e694afe68fb4AspNete79a84MaintainScrollPositionOnPostback.aspx" target="_blank"&gt;讓Chrome瀏覽器支援Asp.Net的MaintainScrollPositionOnPostback&lt;/a&gt;&lt;br&gt;但此網頁已失連許久，也在Google找不到相同提供解決方法的網頁(也許有，我沒找到)。因此特地在此記錄並提供給有遇到同樣問題的朋友一個解決的辦法。&lt;br&gt;&lt;br&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;解決方法：&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;首先在Asp.Net中新增一個瀏覽器定義檔，我們要使用這個定義檔來根據不同瀏覽器設定不同運行環境參數。&lt;br&gt;&lt;a href="http://lh5.ggpht.com/_2sQfBxJU9mI/S97WKYaZkeI/AAAAAAAAMC4/bq0FluxrsA4/s1600-h/2010-05-03_213205%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-05-03_213205" border="0" alt="2010-05-03_213205" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S97WLl8bfRI/AAAAAAAAMC8/myelQix8otU/2010-05-03_213205_thumb%5B2%5D.jpg?imgmax=800" width="504" height="337"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;.browser建立後預設會放在App_Browesers資料夾中。打開.browser後將以下程式碼直接複製貼上：&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;browsers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;browser&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Safari3"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;parentID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Safari1Plus"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;identification&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;userAgent&lt;/span&gt; &lt;span style="color: #ff0000"&gt;match&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Safari/\d+\.\d+"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;identification&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capture&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;userAgent&lt;/span&gt; &lt;span style="color: #ff0000"&gt;match&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Version/(?'version'\d+\.\d+)"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;capture&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capabilities&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capability&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="browser"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Safari3"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capability&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="version"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="${version}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;capabilities&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;controlAdapters&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;adapter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;controlType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="System.Web.UI.WebControls.Menu"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                     &lt;span style="color: #ff0000"&gt;adapterType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=""&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;controlAdapters&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;browser&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;browser&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="GoogleChrome"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;parentID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Safari3"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;identification&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;userAgent&lt;/span&gt; &lt;span style="color: #ff0000"&gt;match&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Chrome/(?'version'\d+\.\d+)"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;identification&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capabilities&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capability&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="browser"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Googlebot"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;capability&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="supportsMaintainScrollPositionOnPostback"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;capabilities&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;browser&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;browsers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;上面這段程式碼原本主要的用途是用來解決Asp.Net中的Menu控制項，在Chrom與Safari瀏覽器下顯示不完全的問題。詳情可以參考：&lt;a href="http://www.cnblogs.com/Whikiey/archive/2009/03/03/1402463.html" target="_blank"&gt;最簡單的方法，讓 ASP.NET Menu 控件在 Google Chrome 瀏覽器上正常顯示&lt;/a&gt;&lt;br&gt;&lt;br&gt;按照原作者的方法直接在GoogleChrome的定義中加入這一行程式碼：&lt;br&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;&amp;lt;capability name="supportsMaintainScrollPositionOnPostback" value="true" /&amp;gt;&lt;br&gt;&lt;/strong&gt;&lt;font color="#000000"&gt;&lt;br&gt;如此即可解決MaintainScrollPositionOnPostback在Chrome瀏覽器失效的問題了，可謂一舉兩得。&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-191091073685822141?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rvtzhv2vnhgMjZQx2XWzMZUsIxw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rvtzhv2vnhgMjZQx2XWzMZUsIxw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rvtzhv2vnhgMjZQx2XWzMZUsIxw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rvtzhv2vnhgMjZQx2XWzMZUsIxw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/YWEX_GNSfCo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/191091073685822141/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/05/chromemaintainscrollpositiononpostback.html#comment-form" title="1 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/191091073685822141" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/191091073685822141" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/YWEX_GNSfCo/chromemaintainscrollpositiononpostback.html" title="讓Chrome瀏覽器支援MaintainScrollPositionOnPostback屬性" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_2sQfBxJU9mI/S97WLl8bfRI/AAAAAAAAMC8/myelQix8otU/s72-c/2010-05-03_213205_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/05/chromemaintainscrollpositiononpostback.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-3058996984593503111</id><published>2010-05-03T21:09:00.001+08:00</published><updated>2010-05-03T21:09:26.112+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">解決FileUpload上傳超過4M大檔案時瀏覽器出現錯誤訊息</title><content type="html">&lt;p&gt;在Asp.Net中若使用FileUpload控制項實作檔案上傳時，除了在上傳按鈕事件中可以使用FileUpload.PostedFile.ContentLength來取得檔案大小來限制使用者上傳檔案大小之外，另外一個我們都會遇到的必需去解決的課題，是在Asp.Net環境中系統預設了最大上傳容量為4M(4096KB)。因此若網站User在上傳的檔案超過4M瀏覽器就會出現錯誤訊息，而User殊不知是自己上傳了過大檔案導致，以為是系統故障了。&lt;br&gt;&lt;br&gt;Asp.Net會有此一限制，是為了能夠避免『&lt;a href="http://zh.wikipedia.org/zh-tw/%E5%88%86%E6%95%A3%E5%BC%8F%E9%98%BB%E6%96%B7%E6%9C%8D%E5%8B%99%E6%94%BB%E6%93%8A" target="_blank"&gt;分散式阻斷服務攻擊&lt;/a&gt;』(DDoS)，免去一些在不懂資安情況之下得到最小限度的保護措施。&lt;br&gt;&lt;br&gt;既然系統幫我們預設了最大上傳，當然爾我們也可以依照個人不同需求來調整這個預設值。設定的方法很簡單，我們只需在&lt;strong&gt;Web.Config&lt;/strong&gt;檔中指定&lt;/p&gt;&lt;a href="http://msdn.microsoft.com/zh-tw/library/e1f13641(VS.80).aspx" target="_blank"&gt;&lt;strong&gt;httpRuntime&lt;/strong&gt;&lt;/a&gt;項目的屬性即可。 &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;httpRuntime&lt;/span&gt; &lt;span style="color: #ff0000"&gt;executionTimeout&lt;/span&gt; = &lt;span style="color: #0000ff"&gt;"1800"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxRequestLength&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="100000"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;&lt;br&gt;executionTimeout&lt;/b&gt;屬性：以秒為單位，代表網頁執行期間所需執行最大秒數(預設是90秒)，若網頁執行超過設定值時間會發生TimeOut的情況。&lt;br&gt;&lt;b&gt;maxRequestLength&lt;/b&gt;屬性：以KB為單位，指定輸入資料流緩衝臨界值的限制，也就是我們所需指定允許最大上傳容量設定值(預設值為4096KB)。&lt;br&gt;&lt;br&gt;&lt;font color="#808080"&gt;補充：&lt;br&gt;&lt;/font&gt;若需自訂超過檔案限制大小時瀏覽器出現錯誤時的頁面，可於Web.Config中設定&lt;a href="http://msdn.microsoft.com/zh-tw/library/h0hfz6fc(VS.80).aspx" target="_blank"&gt;customErrors&lt;/a&gt;項目，自行指定錯誤發生時所需顯示的頁面：&lt;br&gt;&amp;lt;customErrors mode="On" defaultRedirect="ErrorPage.aspx" /&amp;gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;更多內容可參考：&lt;br&gt;&lt;a href="http://blogs.msdn.com/jchiou/archive/2008/03/10/asp-net-4mb.aspx" target="_blank"&gt;ASP.NET 無法上載大型檔案(大於 4MB)&lt;/a&gt;&lt;br&gt;&lt;a href="http://blog.miniasp.com/?tag=/maxrequestlength" target="_blank"&gt;ASP.NET 當上傳檔案過大時任何回應瀏覽器的動作都無效&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-3058996984593503111?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qVv0px6aG2I6HY1AzzqSS2xj5p4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qVv0px6aG2I6HY1AzzqSS2xj5p4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qVv0px6aG2I6HY1AzzqSS2xj5p4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qVv0px6aG2I6HY1AzzqSS2xj5p4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/rqHcOdvZkjM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/3058996984593503111/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/05/fileupload4m.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/3058996984593503111" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/3058996984593503111" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/rqHcOdvZkjM/fileupload4m.html" title="解決FileUpload上傳超過4M大檔案時瀏覽器出現錯誤訊息" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/05/fileupload4m.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-8802354782848626218</id><published>2010-04-29T22:07:00.001+08:00</published><updated>2010-04-29T22:07:02.113+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">[Tips] 在Asp.Net中替VB.Net一次多行註解</title><content type="html">&lt;p&gt;使用VB.Net寫Asp.Net的人一定都知道要註解VB程式碼的方法，直接在要註解那行程式碼最前端加上 ' 號。&lt;br&gt;&lt;br&gt;使用C#可以使用 // 來註解單行，亦可使用 /*&amp;nbsp; */ 來包覆程式碼達到多行註解的功能。那VB如何使用多行註解？很抱歉…VB並不支援多行註解。雖然如此，VB的Programmers也無需過於擔心，若使用的開發軟體為Vistual Studio ，就不需要自己一行一行手動Key ' 號註解了。&lt;br&gt;&lt;br&gt;&lt;font color="#ff8000"&gt;&lt;strong&gt;VB.Net多行註解方法：&lt;br&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;在Vistual Studio上方工具列可以找到如下圖『&lt;strong&gt;註解選取行&lt;/strong&gt;』的按鈕&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S9mSWsx420I/AAAAAAAAMCI/ut_LsKLai20/s1600-h/2010-04-29_214952%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_214952" border="0" alt="2010-04-29_214952" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S9mSXWP_yAI/AAAAAAAAMCM/k9XgaXTL8UM/2010-04-29_214952_thumb%5B2%5D.jpg?imgmax=800" width="504" height="109"&gt;&lt;/a&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;若沒找到，試著從&lt;strong&gt;檢視→工具列→文字編輯器&lt;/strong&gt;，將其工具列打開&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S9mSYPyFbcI/AAAAAAAAMCQ/Hz6bgkSWLVo/s1600-h/2010-04-29_215106%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_215106" border="0" alt="2010-04-29_215106" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S9mSZIlVToI/AAAAAAAAMCU/RJo8tt5v410/2010-04-29_215106_thumb%5B1%5D.jpg?imgmax=800" width="504" height="350"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;OK!接著就是將欲註解的程式碼反白後，直接按下『&lt;strong&gt;註解選取行&lt;/strong&gt;』按鈕&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S9mSZ4SPkZI/AAAAAAAAMCY/lRQxuw_L3eU/s1600-h/2010-04-29_215212%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_215212" border="0" alt="2010-04-29_215212" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S9mSa5wmUwI/AAAAAAAAMCc/4zO4UB__S4E/2010-04-29_215212_thumb%5B1%5D.jpg?imgmax=800" width="504" height="300"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;最後結果所有被反白的程式碼都加上了 ' 號註解了，非常容易又方便呀!&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S9mSbtmnJxI/AAAAAAAAMCg/2OF2zZ6je2k/s1600-h/2010-04-29_215253%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_215253" border="0" alt="2010-04-29_215253" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S9mScl1OwII/AAAAAAAAMCk/aav2j4-MGnY/2010-04-29_215253_thumb%5B1%5D.jpg?imgmax=800" width="504" height="316"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;取消多行註解的方式也一樣，反白程式碼後點擊『&lt;strong&gt;取消註解選取行&lt;/strong&gt;』按鈕即可。&lt;br&gt;&lt;a href="http://lh5.ggpht.com/_2sQfBxJU9mI/S9mSdd1SdOI/AAAAAAAAMCo/AKBN58v_A0c/s1600-h/2010-04-29_215334%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_215334" border="0" alt="2010-04-29_215334" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S9mSfEEmzYI/AAAAAAAAMCs/VmoT0-Wf5uw/2010-04-29_215334_thumb%5B1%5D.jpg?imgmax=800" width="504" height="164"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;或想自己使用&lt;strong&gt;Alt+左鍵&lt;/strong&gt;選取區塊的方式將多行註解選取起來再按下Del鍵刪除也可，看個人習慣囉!&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S9mSgFveTrI/AAAAAAAAMCw/AQAoZVqPTUE/s1600-h/2010-04-29_220336%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-29_220336" border="0" alt="2010-04-29_220336" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S9mShVoEzoI/AAAAAAAAMC0/R2UnW8oY8qs/2010-04-29_220336_thumb%5B1%5D.jpg?imgmax=800" width="504" height="248"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-8802354782848626218?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/loR_QlvPZTo5RCNhP19HYguz1fo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/loR_QlvPZTo5RCNhP19HYguz1fo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/loR_QlvPZTo5RCNhP19HYguz1fo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/loR_QlvPZTo5RCNhP19HYguz1fo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/n7iN-2_h6-Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/8802354782848626218/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/tips-aspnetvbnet.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8802354782848626218" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8802354782848626218" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/n7iN-2_h6-Y/tips-aspnetvbnet.html" title="[Tips] 在Asp.Net中替VB.Net一次多行註解" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_2sQfBxJU9mI/S9mSXWP_yAI/AAAAAAAAMCM/k9XgaXTL8UM/s72-c/2010-04-29_214952_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/tips-aspnetvbnet.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-6329712705059242374</id><published>2010-04-29T21:31:00.001+08:00</published><updated>2010-04-29T21:31:36.547+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">[Tips] 移除ViewState值的兩種寫法</title><content type="html">&lt;p&gt;VB.Net寫法：&lt;br&gt;&lt;br&gt;1、將ViewState("Test")值移除&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;ViewState.Remove("Test")&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;or&lt;br&gt;&lt;br&gt;2、ViewState("Test")值設為Null&lt;br&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;ViewState("Test") = DBNull.Value&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-6329712705059242374?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Dm2ONbbDhB-qlApHu_iWfm5VSiI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Dm2ONbbDhB-qlApHu_iWfm5VSiI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Dm2ONbbDhB-qlApHu_iWfm5VSiI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Dm2ONbbDhB-qlApHu_iWfm5VSiI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/wY_NEMNUGBQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/6329712705059242374/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/tips-viewstate.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6329712705059242374" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6329712705059242374" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/wY_NEMNUGBQ/tips-viewstate.html" title="[Tips] 移除ViewState值的兩種寫法" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/tips-viewstate.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-8975750497768352307</id><published>2010-04-28T21:39:00.002+08:00</published><updated>2010-04-28T21:40:08.907+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="資訊新鮮事" /><title type="text">想做你的CODE：Vistual Studio 2010全球發佈會宣傳影片</title><content type="html">『&lt;b&gt;想做你的CODE&lt;/b&gt;』：&lt;b&gt;更痛快地CODING，給愛更多好心情……&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Programer時最容易犯的毛病，除了CODING卻忽略身邊太多的事物，這挺符合Vistual Studio強調的快速開發。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:c3bbaf46-ef83-4c80-a398-c74610c4c2e4" style="display: inline; float: none; margin: 0px; padding: 0px;"&gt;&lt;div id="99bda722-b388-4525-b36b-e4c1b1e21499" style="display: inline; margin: 0px; padding: 0px;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=0gliakvtTgs&amp;amp;hl=zh_TW&amp;amp;fs=1&amp;amp;" target="_new"&gt;&lt;img alt="" galleryimg="no" onload="var downlevelDiv = document.getElementById('99bda722-b388-4525-b36b-e4c1b1e21499'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/0gliakvtTgs&amp;amp;hl=zh_TW&amp;amp;fs=1&amp;amp;&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/0gliakvtTgs&amp;amp;hl=zh_TW&amp;amp;fs=1&amp;amp;&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S9g6ht0jH2I/AAAAAAAAMCE/AuPEh2f-SpY/videof823711f3060%5B4%5D.jpg?imgmax=800" style="border-style: none;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-8975750497768352307?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0c-_exicAR51wF8EWDh1CGL6vXI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0c-_exicAR51wF8EWDh1CGL6vXI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0c-_exicAR51wF8EWDh1CGL6vXI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0c-_exicAR51wF8EWDh1CGL6vXI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/36J3h9d1VjA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/8975750497768352307/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/codevistual-studio-2010.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8975750497768352307" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8975750497768352307" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/36J3h9d1VjA/codevistual-studio-2010.html" title="想做你的CODE：Vistual Studio 2010全球發佈會宣傳影片" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_2sQfBxJU9mI/S9g6ht0jH2I/AAAAAAAAMCE/AuPEh2f-SpY/s72-c/videof823711f3060%5B4%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/codevistual-studio-2010.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-7580507865702070782</id><published>2010-04-27T22:44:00.001+08:00</published><updated>2010-04-27T22:44:57.094+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">解決Asp.net網站佈署至國外虛擬主機日期格式不同的問題</title><content type="html">&lt;p&gt;若您與我一樣使用的是國外虛擬主機運作Asp.Net網站，可能需要注意一下在不同語系的Server系統上，會產生不同日期格式的問題。由於國外虛擬主機用的是英文版的Windows Server，網站中若有使用到DateTime抓取系統時間也會自動顯示為國外的日期格式。&lt;br&gt;&lt;br&gt;雖然DateTime可加上ToString來自訂日期格式，如DateTime.ToString("yyyy/MM/dd HH:mm:ss")，但某些Asp.Net的extender也會跟著系統的語系顯示不同語系，如Ajax ControlToolKit 的CalendarExtender。&lt;br&gt;&lt;br&gt;要避免此問題最方便的方法是直接在&lt;strong&gt;Web.Config&lt;/strong&gt;檔案中指定網站程式預設語系為zh-Tw(中文)語系。&lt;br&gt;&lt;br&gt;&lt;font color="#ff8000"&gt;設定方法：&lt;/font&gt;&lt;br&gt;在Web.Config檔中加入&lt;br&gt;&amp;lt;system.web&amp;gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&lt;font color="#0000ff"&gt;&amp;lt;globalization culture="zh-TW' /&amp;gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&amp;lt;/system.web&amp;gt;&lt;br&gt;&lt;br&gt;如此不管使用的運行的Server語系為何，網站都會以中文語系顯示了。&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-7580507865702070782?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0IVFhHpObaPz1rxQzIomvhbtMCw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0IVFhHpObaPz1rxQzIomvhbtMCw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0IVFhHpObaPz1rxQzIomvhbtMCw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0IVFhHpObaPz1rxQzIomvhbtMCw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/W9ZiLW6hOC0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/7580507865702070782/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/aspnet.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/7580507865702070782" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/7580507865702070782" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/W9ZiLW6hOC0/aspnet.html" title="解決Asp.net網站佈署至國外虛擬主機日期格式不同的問題" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/aspnet.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-6370073518173448616</id><published>2010-04-27T22:16:00.002+08:00</published><updated>2010-04-27T22:19:30.018+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">設定Html編輯器FreeTextBox在Enter換行時為&lt;br&gt;</title><content type="html">最近在一個專案中使用了免費版的&lt;b&gt;&lt;a href="http://www.freetextbox.com/" target="_blank"&gt;FreeTextBox&lt;/a&gt;&lt;/b&gt;線上Html編輯器，發現的問題是在FreeTextBox編輯內容按下Enter鍵換行時，不同瀏覽器下的換行行距會有所不同。&lt;br /&gt;&lt;br /&gt;以下為各瀏覽器在FreeTextBox下Enter鍵預設輸出的語法：&lt;br /&gt;Firefox → &amp;lt;br&amp;gt;&lt;br /&gt;Chrome → &amp;lt;div&amp;gt;&lt;br /&gt;IE8 → &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;Opera → &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;顯然的IE8與Opera的&amp;lt;p&amp;gt;段落即為造成換行行距過大的問題所在。因不可能告知所有網站User要換行請使用Shift+Enter來產生&amp;lt;br&amp;gt;換行，我希望找到方法使得Enter預設值可由&amp;lt;p&amp;gt;段落改為使用&amp;lt;br&amp;gt;換行語法。&lt;br /&gt;&lt;br /&gt;在FreeTextBox中有個屬性值為&lt;span style="color: blue;"&gt;&lt;b&gt;BreakMode&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;b&gt;，&lt;/b&gt;說明文件&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;對屬性解釋如下：&lt;/span&gt;&lt;br /&gt;&lt;span style="color: navy;"&gt;&lt;span style="color: green;"&gt;.BreakMode&lt;br /&gt;Sets&amp;nbsp;&amp;nbsp; what&amp;nbsp;&amp;nbsp; happens&amp;nbsp;&amp;nbsp; when&amp;nbsp;&amp;nbsp; the&amp;nbsp;&amp;nbsp; "Enter"&amp;nbsp;&amp;nbsp; key&amp;nbsp;&amp;nbsp; is&amp;nbsp;&amp;nbsp; pressed.&amp;nbsp;&amp;nbsp; Options&amp;nbsp;&amp;nbsp; are&amp;nbsp;&amp;nbsp; LineBreak&amp;nbsp;&amp;nbsp; (IE&amp;nbsp;&amp;nbsp; and&amp;nbsp;&amp;nbsp; Mozilla)&amp;nbsp;&amp;nbsp; and&amp;nbsp;&amp;nbsp; Paragraph&amp;nbsp;&amp;nbsp; (IE&amp;nbsp;&amp;nbsp; only)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;FreeTextBox的BreakMode預設值為Paragraph(段落)，因此只要設定&lt;b&gt;&lt;span style="color: red;"&gt;BreakMode="LineBreak" &lt;/span&gt;&lt;/b&gt;即可將預設&amp;lt;p&amp;gt;更改為&amp;lt;br&amp;gt;。&lt;br /&gt;&lt;br /&gt;根據說明文件可以得知設定LineBreak模式只能影響IE與FireFox瀏覽器，在Chrome及Opera是無效的，這點需要特別注意一下。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-6370073518173448616?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/51supZZCT9Tuq6CWAE9zygBxmC4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/51supZZCT9Tuq6CWAE9zygBxmC4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/51supZZCT9Tuq6CWAE9zygBxmC4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/51supZZCT9Tuq6CWAE9zygBxmC4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/taah4S9q-x8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/6370073518173448616/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/htmlfreetextboxenter.html#comment-form" title="1 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6370073518173448616" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6370073518173448616" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/taah4S9q-x8/htmlfreetextboxenter.html" title="設定Html編輯器FreeTextBox在Enter換行時為&amp;lt;br&amp;gt;" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/htmlfreetextboxenter.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-3762060835848567629</id><published>2010-04-22T21:44:00.001+08:00</published><updated>2010-04-22T21:44:48.819+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">SqlDataSource設計模式中SelectCommand使用If…Else條件</title><content type="html">&lt;p&gt;一般來說我們都會將使用codebehind的方式來指定SqlDataSource的SelectCommand內容。但在比較複雜的邏輯程式中不得已必須在設計模式中直接指定SelectCommand內容，又需要對某控制項來取值作為SQL中的Where條件時，我們可以使用T-SQL中的條件語法If…Else來實現。&lt;br&gt;&lt;br&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;T-SQL If…Else 架構：&lt;/strong&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;If&amp;nbsp; 條件式&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Begin&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T-SQL語法&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End&lt;br&gt;Else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Begin&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T-SQL語法&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Begin End是用來設定T-SQL程式碼範圍，若你的T-SQL語法超過一行請務必記得加上Begin End，否則你會發現就算寫了多行也只會執行第一行程式。最好是養成不管一行多行程式都用Begin….End包起來的好習慣。&lt;br&gt;&lt;br&gt;&lt;strong&gt;範例：&lt;/strong&gt;&lt;br&gt;在SqlDataSource的SelectCommand對DropDownList控制項取值，判斷DropDownList值是否為All來達成不同條件資料過濾。&lt;br&gt;&lt;br&gt;DropDownList內容：&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:DropDownList&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="DropDownList"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #ff0000"&gt;AppendDataBoundItems&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="True"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Sort_SqlDataSource"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #ff0000"&gt;DataTextField&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="分類項目"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DataValueField&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="分類編號"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:ListItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="All"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;請選擇&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:ListItem&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:DropDownList&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SqlDataSource&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Sort_SqlDataSource"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #ff0000"&gt;ConnectionString&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="&amp;lt;%$ ConnectionStrings:TestConnectionString %&amp;gt;"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #ff0000"&gt;SelectCommand&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="SELECT * FROM 分類"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SqlDataSource&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;SqlDataSource SelectCommand內容：&lt;br&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SqlDataSource&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="SqlDataSource"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;ConnectionString&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="&amp;lt;%$ ConnectionStrings:TestConnectionString %&amp;gt;"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;SelectCommand&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="if (@分類項目='All') begin Select * From 測試 end else begin Select * From 測試 Where 分類項目=@分類項目 end"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:ControlParameter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ControlID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="DropDownList"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="分類項目"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PropertyName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="SelectedValue"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SqlDataSource&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-3762060835848567629?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Jb6gLeNH4O1-Qa1ZR5S_LmKHr3A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Jb6gLeNH4O1-Qa1ZR5S_LmKHr3A/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Jb6gLeNH4O1-Qa1ZR5S_LmKHr3A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Jb6gLeNH4O1-Qa1ZR5S_LmKHr3A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/5DMytrps4p4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/3762060835848567629/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/sqldatasourceselectcommandifelse.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/3762060835848567629" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/3762060835848567629" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/5DMytrps4p4/sqldatasourceselectcommandifelse.html" title="SqlDataSource設計模式中SelectCommand使用If…Else條件" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/sqldatasourceselectcommandifelse.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-365026771057909910</id><published>2010-04-15T20:37:00.001+08:00</published><updated>2010-04-15T20:37:18.042+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">[Ajax]CalendarExtender與TextBox的ReadOnly設為True取不到值的解決方法</title><content type="html">&lt;p&gt;使用CalendarExtender控制項時通常一定會搭配TextBox控制項，且定會想將TexBox欄位設為唯讀來防止User自行輸入一些不符合資料庫欄位規格的日期格式。&lt;br&gt;&lt;br&gt;然而從Asp.Net 2.0開始若將TextBox設為ReadOnly後會發現，在PostBack後卻無法順利取得TextBox.Text值，這是Asp.Net 2.0後基於安全性考量而作的改變。&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;解決方法：&lt;br&gt;&lt;/font&gt;&lt;font color="#000000"&gt;不在設計模式中設定TextBox的唯獨屬性，而在codebehind的Page_Load事件中使用&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.webcontrol.attributes%28VS.80%29.aspx"&gt;WebControl.Attributes&lt;/a&gt; 屬性動態加入唯獨屬性的設定。&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; Page_Load(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Load&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Not&lt;/span&gt; IsPostBack &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           TextBox.Attributes.Add(&lt;span style="color: #006080"&gt;"readonly"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"true"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-365026771057909910?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dSBeRfQUqdJj6B9W9H0II3XS9DM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dSBeRfQUqdJj6B9W9H0II3XS9DM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dSBeRfQUqdJj6B9W9H0II3XS9DM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dSBeRfQUqdJj6B9W9H0II3XS9DM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/_IpyQGTSfJg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/365026771057909910/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/ajaxcalendarextendertextboxreadonlytrue.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/365026771057909910" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/365026771057909910" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/_IpyQGTSfJg/ajaxcalendarextendertextboxreadonlytrue.html" title="[Ajax]CalendarExtender與TextBox的ReadOnly設為True取不到值的解決方法" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/ajaxcalendarextendertextboxreadonlytrue.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-2594619284010349837</id><published>2010-04-14T22:51:00.001+08:00</published><updated>2010-04-14T22:54:13.746+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">解決[Ajax]CalendarExtender彈出時被GridView或其它物件遮擋的問題</title><content type="html">&lt;p&gt;&lt;a href="http://lh6.ggpht.com/_2sQfBxJU9mI/S8XWZfEXUKI/AAAAAAAAMB0/OastlHbh764/s1600-h/2010-04-14_223340%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-14_223340" border="0" alt="2010-04-14_223340" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S8XWafRbHtI/AAAAAAAAMB4/dnB3U4cFIvM/2010-04-14_223340_thumb%5B2%5D.jpg?imgmax=800" width="504" height="195"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;上圖的CalendarExtender日曆控制項彈出時被下方的GridView Header 的Div Css擋住了。我們必須使CalendarExtender能永遠顯示在畫面最頂端，&lt;br&gt;正常的情況應該如下圖：&lt;br&gt;&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S8XWbhY80sI/AAAAAAAAMB8/Y3_19T8ltfQ/s1600-h/2010-04-14_223408%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-14_223408" border="0" alt="2010-04-14_223408" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S8XWck7WtbI/AAAAAAAAMCA/9dP_dxjA0N4/2010-04-14_223408_thumb%5B1%5D.jpg?imgmax=800" width="504" height="196"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;解決方法：&lt;/font&gt;&lt;br&gt;我們將寫一個Css並將其指定給CalendarExtender：&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ajaxtoolkit:calendarextender&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CalendarExtender"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #ff0000"&gt;TargetControlID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Date"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PopupButtonID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Calendar_Image"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #ff0000"&gt;Format&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="yyyy/MM/dd"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;FirstDayOfWeek&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Monday"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CssClass&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="cssCalendar"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;CalendarExtender CSS內容中將月曆控制項指定z-index屬性。z-index是用來指定圖層的層數，例如z-index:1為最底層，z-index:2為第2層以此類推。&lt;br&gt;最重要的是需將此CSS 的z-index屬性寫在&lt;strong&gt;.ajax__calendar_container&lt;br&gt;&lt;/strong&gt;代表將整個CalendarExtender 容器的層數設為最頂層(除非你自己故意將其它Div設到1001層否則CalendarExtender 會在最頂層)&lt;br&gt;&lt;br&gt;如：&lt;/p&gt;&lt;br /&gt;&lt;p&gt;.cssCalendar .ajax__calendar_container&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z-index:1000;&lt;br&gt;}&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-2594619284010349837?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ymCHcDLktIVXkydvNVHleu0rVxA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ymCHcDLktIVXkydvNVHleu0rVxA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ymCHcDLktIVXkydvNVHleu0rVxA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ymCHcDLktIVXkydvNVHleu0rVxA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/dIXu1_dy0OA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/2594619284010349837/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/calendarextendergridview.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2594619284010349837" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2594619284010349837" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/dIXu1_dy0OA/calendarextendergridview.html" title="解決[Ajax]CalendarExtender彈出時被GridView或其它物件遮擋的問題" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_2sQfBxJU9mI/S8XWafRbHtI/AAAAAAAAMB4/dnB3U4cFIvM/s72-c/2010-04-14_223340_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/calendarextendergridview.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-846811042122293874</id><published>2010-04-14T22:23:00.001+08:00</published><updated>2010-04-14T22:25:45.214+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">GridView實作資料筆數、頁數統計(使用SqlDataSource繫結方式)</title><content type="html">&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S8XP9zaLaqI/AAAAAAAAMBs/GlDcP5WCKoU/s1600-h/2010-04-14_220709%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-14_220709" border="0" alt="2010-04-14_220709" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S8XP_H6TAyI/AAAAAAAAMBw/2v2dnury-gA/2010-04-14_220709_thumb%5B2%5D.jpg?imgmax=800" width="504" height="341"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;在此要介紹的是使用GridView指定DataSourceID為SqlDataSource的資料繫結方式情況下，實現如上圖統計GridView的資料筆數與分頁數功能。&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;計算GridView筆數：&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;'計算筆數&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; SqlDataSource_Selected(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; SqlDataSource.Selected&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    CountLots.Text = &lt;span style="color: #006080"&gt;"合計"&lt;/span&gt; + e.AffectedRows.ToString() + &lt;span style="color: #006080"&gt;"筆"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#808080"&gt;注意：利用 SqlDataSource取得資料受影響筆數必須要將DataSourceMode設為DataSet，否則取得的筆數皆為0。&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;計算GridView頁數：&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;'計算頁數&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; GridView_DataBound(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; GridView.DataBound&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Not&lt;/span&gt; CountPage &lt;span style="color: #0000ff"&gt;Is&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; currentPage &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt; = GridView.PageIndex + 1&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        CountPage.Text = &lt;span style="color: #006080"&gt;" 共"&lt;/span&gt; &amp;amp; GridView.PageCount.ToString() &amp;amp; &lt;span style="color: #006080"&gt;"頁"&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-846811042122293874?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1SmrwoavEpYbo96k_y6f-8HLWls/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1SmrwoavEpYbo96k_y6f-8HLWls/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1SmrwoavEpYbo96k_y6f-8HLWls/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1SmrwoavEpYbo96k_y6f-8HLWls/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/gUkEAKoO170" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/846811042122293874/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/gridviewsqldatasource.html#comment-form" title="2 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/846811042122293874" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/846811042122293874" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/gUkEAKoO170/gridviewsqldatasource.html" title="GridView實作資料筆數、頁數統計(使用SqlDataSource繫結方式)" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_2sQfBxJU9mI/S8XP_H6TAyI/AAAAAAAAMBw/2v2dnury-gA/s72-c/2010-04-14_220709_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/gridviewsqldatasource.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-8565242160232138162</id><published>2010-04-14T21:53:00.001+08:00</published><updated>2010-04-14T21:53:27.530+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">Asp.net加密Web.config檔的資料庫&lt;connectionStrings&gt;連線資訊內容</title><content type="html">&lt;p&gt;在&lt;strong&gt;Web.config&lt;/strong&gt;檔中的&lt;strong&gt;&amp;lt;connectionString&amp;gt;&lt;/strong&gt;區段儲存的是資料庫的連線資訊，包含主機IP、資料庫登入帳號、密碼等等重要機密資訊。因此在將網站正式上線以前必須作的其中一項重要事情，便是將&amp;lt;connectionString&amp;gt;區段中的重要資訊經過加密轉換，在此我們選擇使用&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.configuration.rsaprotectedconfigurationprovider%28VS.80%29.aspx"&gt;RsaProtectedConfigurationProvider&lt;/a&gt;類別的加密解密方式來實現保護&amp;lt;connectionString&amp;gt;的功能。&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;加密方法：&lt;/font&gt;&lt;br&gt;1、從開始→執行中輸入cmd指令來開啟DOS指令視窗&lt;br&gt;2、在DOS視窗中我們需要先切換至.NET Framework目錄下來執行：因此&amp;nbsp; 輸入&lt;strong&gt;cd \WINDOWS\Microsoft.Net\Framework\v2.0.*&lt;br&gt;&lt;/strong&gt;3、在此目錄下有支&lt;b&gt;aspnet_regiis&lt;/b&gt;.exe的程式，我們使用此支執行檔來實現加密的功能：輸入&lt;strong&gt;aspnet_regiis -pe "connectionStrings" -app "/網站名" -prov "RSAProtectedConfigurationProvider"&lt;br&gt;&lt;a href="http://lh5.ggpht.com/_2sQfBxJU9mI/S8XI0YyiSLI/AAAAAAAAMBk/zk10Qd_flEg/s1600-h/2010-04-14_215143%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-14_215143" border="0" alt="2010-04-14_215143" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S8XI1pkLJgI/AAAAAAAAMBo/GyI_bVlTzEY/2010-04-14_215143_thumb%5B2%5D.jpg?imgmax=800" width="504" height="176"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;&lt;/strong&gt;&lt;font color="#0000ff"&gt;解密方法：&lt;/font&gt;&lt;br&gt;1、同上先切換至.NET Framework目錄下來執行&lt;b&gt;aspnet_regiis&lt;/b&gt;.exe的程式&lt;br&gt;2、輸入&lt;strong&gt;aspnet_regiis -pd "connectionStrings" -app "/網站名" -prov "RSAProtectedConfigurationProvider"&lt;br&gt;&lt;br&gt;&lt;/strong&gt;&lt;font color="#ff80c0"&gt;參數說明：&lt;/font&gt;&lt;/p&gt; &lt;p&gt;-pe : 加密 &lt;p&gt;-pd : 解密 &lt;p&gt;-app : 欲加密的網站目錄名稱 &lt;p&gt;-prov : 加密方式&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-8565242160232138162?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2WXq1TWR3h_e2LQNTI5--afV4vU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2WXq1TWR3h_e2LQNTI5--afV4vU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2WXq1TWR3h_e2LQNTI5--afV4vU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2WXq1TWR3h_e2LQNTI5--afV4vU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/gSADW0eJWcY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/8565242160232138162/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/aspnetwebconfig.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8565242160232138162" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8565242160232138162" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/gSADW0eJWcY/aspnetwebconfig.html" title="Asp.net加密Web.config檔的資料庫&amp;lt;connectionStrings&amp;gt;連線資訊內容" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_2sQfBxJU9mI/S8XI1pkLJgI/AAAAAAAAMBo/GyI_bVlTzEY/s72-c/2010-04-14_215143_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/aspnetwebconfig.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-175429521990619742</id><published>2010-04-14T21:03:00.001+08:00</published><updated>2010-04-14T21:03:21.874+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">剖析器錯誤訊息：無法從組件……載入型別……(解決方法)</title><content type="html">&lt;p&gt;&lt;strong&gt;剖析器錯誤訊息: 無法從組件 &lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' &lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;載入型別 'System.Web.UI.Compatibility.CompareValidator'。&lt;/strong&gt;&lt;br&gt;&lt;br&gt;錯誤原因：&lt;br&gt;在Asp.Net網頁運行時出現此訊息，代表您運行的網站程式碼中使用了Ajax Control Toolkit For .NET3.5 SP1版本的控制項；而運行的Visual Studio 2008 環境未安裝SP1更新補丁。&lt;br&gt;&lt;br&gt;解決方法：&lt;br&gt;下載&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=27673C47-B3B5-4C67-BD99-84E525B5CE61&amp;amp;displaylang=en"&gt;Visual Studio 2008 Sp1&lt;/a&gt;(ISO檔)後安裝更新檔即可。&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-175429521990619742?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eiB4DlRY50dBVk4uRtQdyDZCdLc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eiB4DlRY50dBVk4uRtQdyDZCdLc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eiB4DlRY50dBVk4uRtQdyDZCdLc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eiB4DlRY50dBVk4uRtQdyDZCdLc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/cbeaXW7zLWk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/175429521990619742/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/blog-post.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/175429521990619742" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/175429521990619742" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/cbeaXW7zLWk/blog-post.html" title="剖析器錯誤訊息：無法從組件……載入型別……(解決方法)" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/blog-post.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-2677783701141349398</id><published>2010-04-06T19:57:00.001+08:00</published><updated>2010-04-06T19:57:51.408+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">Asp.Net -Cookie讀取中文變亂碼的解決方法</title><content type="html">&lt;p&gt;有時我的可能因為特別需求，必須使用Cookie來存放簡短的中文字。但中文字的編碼與Cookie預設的編碼方式不同，因此必須先行在URL傳輸過程中經過一道編碼、解碼的程序，才不會發生中文字在Cookie中讀取出來為亂碼的情況。&lt;br&gt;&lt;br&gt;一般建立Cookie的寫法為：&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; cookie &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; HttpCookie(&lt;span style="color: #006080"&gt;"UserInfo"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"Login"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"OK"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"No"&lt;/span&gt;, dr(&lt;span style="color: #006080"&gt;"員工編號"&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"Name"&lt;/span&gt;, (dr(&lt;span style="color: #006080"&gt;"員工姓名"&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Response.Cookies.Add(cookie)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;由於其中"Name"的Cookie內容存放的是中文字員工姓名，讀取時使用Request.Cookies("UserInfo")("Name")後，會發現讀到的中文已經變為亂碼。&lt;br&gt;&lt;br&gt;我們將原本的寫法加入&lt;strong&gt;&lt;a href="http://msdn.microsoft.com/zh-tw/library/4fkewx0t%28VS.80%29.aspx" target="_blank"&gt;HttpUtility.UrlEncode&lt;/a&gt;&lt;/strong&gt;(編碼)與&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.web.httputility.urldecode%28VS.80%29.aspx" target="_blank"&gt;HttpUtility.UrlDecode&lt;/a&gt;&lt;strong&gt;&lt;/strong&gt;(解碼)，在URL中傳輸而進行編碼的字串轉換來解決亂碼的問題。修改後程式碼如下：&lt;br&gt;&lt;br&gt;建立Cookie時編碼：&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; cookie &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; HttpCookie(&lt;span style="color: #006080"&gt;"UserInfo"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"Login"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"OK"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"No"&lt;/span&gt;, dr(&lt;span style="color: #006080"&gt;"員工編號"&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;cookie.Values.Add(&lt;span style="color: #006080"&gt;"Name"&lt;/span&gt;, HttpUtility.UrlEncode(dr(&lt;span style="color: #006080"&gt;"員工姓名"&lt;/span&gt;)))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Response.Cookies.Add(cookie)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;讀取時解碼：&lt;br&gt;HttpUtility.UrlDecode(Request.Cookies("UserInfo")("Name"))&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-2677783701141349398?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gu4Qmv-vioulKgNKyiZ4iGa1cUg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gu4Qmv-vioulKgNKyiZ4iGa1cUg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gu4Qmv-vioulKgNKyiZ4iGa1cUg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gu4Qmv-vioulKgNKyiZ4iGa1cUg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/zB0S0fa48c0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/2677783701141349398/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/aspnet-cookie.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2677783701141349398" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2677783701141349398" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/zB0S0fa48c0/aspnet-cookie.html" title="Asp.Net -Cookie讀取中文變亂碼的解決方法" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/aspnet-cookie.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-7930205537267512364</id><published>2010-04-03T15:34:00.001+08:00</published><updated>2010-04-03T15:48:10.564+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">伺服器 'Localhost\SQLEXPRESS' 上的 MSDTC 無法使用。</title><content type="html">&lt;p&gt;&lt;font color="#000000"&gt;若在操作Asp.Net網站時發生『&lt;/font&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;伺服器 'Localhost\SQLEXPRESS' 上的 MSDTC 無法使用。&lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;』的錯誤訊息，那麼一定是在進行資料庫存取時使用了&lt;/font&gt;&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.transactions.transactionscope%28VS.80%29.aspx" target="_blank"&gt;&lt;font color="#535353"&gt;&lt;font color="#ff0000"&gt;TransactionScope&lt;/a&gt;&lt;font color="#000000"&gt;的交易機制來確保交易的完整性。&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#000000"&gt;在程式碼中加入TransactionScope交易機制的同時，也需要在網站Server上開啟&lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Distributed_Transaction_Coordinator" target="_blank"&gt;MSDTC&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(Microsoft Distributed Transaction Coordination)分散式異動交易的系統服務，否則就會看到『伺服器 'Localhost\SQLEXPRESS' 上的 MSDTC 無法使用。』的錯誤訊息。由於MSDTC在XP系統中預設是不開啟，因此我們需要將其開啟並設為自動開啟。&lt;br&gt;&lt;/font&gt;&lt;font color="#ff0000"&gt;&lt;font color="#000000"&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;開啟MSDTC方法&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000"&gt;：(以XP為例)&lt;br&gt;[控制台]→[系統管理工具]→[服務]&lt;br&gt;找到『&lt;strong&gt;Distributed Transaction Coordinator&lt;/strong&gt;』的服務名稱&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S7bviULrG-I/AAAAAAAAMBI/FpGUJ8Vr9Yg/s1600-h/2010-04-03_152712%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-03_152712" border="0" alt="2010-04-03_152712" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S7bvjzuDpvI/AAAAAAAAMBM/ZSY9X3E-OK8/2010-04-03_152712_thumb%5B2%5D.jpg?imgmax=800" width="504" height="192"&gt;&lt;/a&gt; &lt;br&gt;在其名稱上按[右鍵]→[內容]&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S7bvk8o-M4I/AAAAAAAAMBQ/YNnlyOj4ANw/s1600-h/2010-04-03_152846%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-03_152846" border="0" alt="2010-04-03_152846" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S7bvl69c0_I/AAAAAAAAMBU/Z-9vajdRXys/2010-04-03_152846_thumb%5B1%5D.jpg?imgmax=800" width="487" height="243"&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;進入內容後如下圖將&lt;strong&gt;啟動類型&lt;/strong&gt;改為&lt;font color="#ff0000"&gt;自動&lt;/font&gt;、&lt;strong&gt;服務狀態&lt;/strong&gt;將其&lt;font color="#ff0000"&gt;啟動&lt;/font&gt;。&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S7bvmyANaQI/AAAAAAAAMBY/qA5RoLmqrDw/s1600-h/2010-04-03_152945%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-04-03_152945" border="0" alt="2010-04-03_152945" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S7bvofsYnZI/AAAAAAAAMBc/dJB31IdTgrw/2010-04-03_152945_thumb%5B3%5D.jpg?imgmax=800" width="404" height="450"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;完成設定後，Asp.Net網站即可正確的執行TransactionScope交易機制。&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-7930205537267512364?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Kl_0lACH1omkiw_zLT9ON24gEHQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Kl_0lACH1omkiw_zLT9ON24gEHQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Kl_0lACH1omkiw_zLT9ON24gEHQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Kl_0lACH1omkiw_zLT9ON24gEHQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/YaMu_QTb1L4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/7930205537267512364/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/msdtc.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/7930205537267512364" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/7930205537267512364" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/YaMu_QTb1L4/msdtc.html" title="伺服器 &amp;#39;Localhost\SQLEXPRESS&amp;#39; 上的 MSDTC 無法使用。" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_2sQfBxJU9mI/S7bvjzuDpvI/AAAAAAAAMBM/ZSY9X3E-OK8/s72-c/2010-04-03_152712_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/msdtc.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-998715372834538636</id><published>2010-04-03T14:55:00.001+08:00</published><updated>2010-04-03T14:56:40.127+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">GridView隱藏欄位(Visible="Flase")後取不到值的替代方法</title><content type="html">&lt;p&gt;有時我們需要在GridView中設置欄位來取值，以作為後續動作的資料來源判斷依據，但又不想在使用者瀏覽時顯示此欄位。例：GridView中使用BoundField 來取得存檔日期的值同時將其欄位設為不顯示&lt;em&gt;，&amp;lt;asp:BoundField DataField="存檔日期" Visible="false" /&amp;gt;&lt;/em&gt;。這時在GridView的RowDataBound事件中使用e.Row.Cells(0).Text的方式取值會發現無法順利取到值。 &lt;br&gt;&lt;br&gt;因此需要使用另一種替代方式來達到此目的的實現，在Asp.Net中有個專為隱藏數值設計的控制項&lt;strong&gt;HiddenField&lt;/strong&gt;，我們要作的就是將原本&lt;em&gt;&amp;lt;asp:BoundField DataField="存檔日期" Visible="false" /&amp;gt;&lt;/em&gt;的資料繫結方式改為使用HiddenField的Value值與存檔日期繫結，並將此HiddenField控制項置於GridView的&lt;strong&gt;TemplateField&lt;/strong&gt;中。&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &amp;lt;asp:HiddenField ID=&lt;span style="color: #006080"&gt;"SaveTime"&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;"server"&lt;/span&gt; Value=&lt;span style="color: #008000"&gt;'&amp;lt;%# Eval("存檔日期") %&amp;gt;' /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;如此便可在GridView的RowDataBound事件中使用&lt;strong&gt;FindControl&lt;/strong&gt;的方式來取得GridView各個欄位中的存檔日期值。&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; GridView_RowDataBound(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Web.UI.WebControls.GridViewRowEventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; GridView.RowDataBound&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; e.Row.RowType = DataControlRowType.DataRow &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        Response.Write(&lt;span style="color: #0000ff"&gt;CType&lt;/span&gt;(e.Row.FindControl(&lt;span style="color: #006080"&gt;"SaveTime"&lt;/span&gt;), HiddenField).Value)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-998715372834538636?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ujD3gUNc9R-XljwhWn-kzfZYK9o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ujD3gUNc9R-XljwhWn-kzfZYK9o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ujD3gUNc9R-XljwhWn-kzfZYK9o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ujD3gUNc9R-XljwhWn-kzfZYK9o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/FqRjCYOfDvc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/998715372834538636/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/gridviewvisible.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/998715372834538636" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/998715372834538636" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/FqRjCYOfDvc/gridviewvisible.html" title="GridView隱藏欄位(Visible=&amp;quot;Flase&amp;quot;)後取不到值的替代方法" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/gridviewvisible.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-197170887349428474</id><published>2010-04-03T11:17:00.002+08:00</published><updated>2010-04-27T11:58:11.264+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">DataList包DataList中建立子DataList的ItemCommand事件</title><content type="html">DataList包DataList此種用法最常見的如部落格文章的回應功能。頁面中使用DataList來Show出多筆文章，文章的DataList中再套入Datalist來顯示多筆回應內容。如此形成兩層DataList的情況後，我們在實作時首先會發現在Vistual Studio中找不到子DataList的事件選項供自己選擇。&lt;br /&gt;&lt;br /&gt;遇到此種情況便需要我們自己來手動建立子DataList事件了。在網路上你可以找到不只一種建立子DataList的方法，在此我將個人認為最簡單的建立事件方法記錄如下。&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: blue;"&gt;方法：&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;手動建立&lt;b&gt;Public Sub&lt;/b&gt;後，在子DataList中指定&lt;b&gt;OnItemCommand&lt;/b&gt;事件並觸發Public Sub。我們需要作的事是在DataList2中手動輸入&lt;b&gt;OnItemCommand=" Plublic Sub事件名稱 "&lt;/b&gt; (如程式第10行)。&lt;br /&gt;&lt;br /&gt;Test.aspx&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:DataList&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="DataList1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;DataKeyField&lt;/span&gt;&lt;span style="color: blue;"&gt;="拜訪編號"&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     &lt;span style="color: red;"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue;"&gt;="SqlDataSource1"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;font&lt;/span&gt; &lt;span style="color: red;"&gt;color&lt;/span&gt;&lt;span style="color: blue;"&gt;="red"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;             拜訪編號:&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;             &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="拜訪編號Label"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;='&amp;lt;%# Eval("拜訪編號") %&amp;gt;'&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;             &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="Button1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;="按鈕1"&lt;/span&gt; &lt;span style="color: red;"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue;"&gt;="TestButton"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;font&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:DataList&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="DataList2"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;         &lt;span style="color: red;"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue;"&gt;="SqlDataSource2"&lt;/span&gt; &lt;span style="color: red;"&gt;OnItemCommand&lt;/span&gt;&lt;span style="color: blue;"&gt;="DataList2_ItemCommand"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;             拜訪目的:&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;             &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="拜訪目的Label"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;='&amp;lt;%# Eval("拜訪目的") %&amp;gt;'&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;             &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="Button1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;="按鈕2"&lt;/span&gt; &lt;span style="color: red;"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue;"&gt;="TestButton2"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:DataList&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;         &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;br&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;     &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp:DataList&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;在Test.aspx.vb中建立Public Sub，其名稱為&lt;b&gt;OnItemCommand&lt;/b&gt;事件指定呼叫的名稱。&lt;br /&gt;&lt;br /&gt;Test.aspx.vb&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; DataList2_ItemCommand(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; source &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Web.UI.WebControls.DataListCommandEventArgs)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     &lt;span style="color: blue;"&gt;If&lt;/span&gt; e.CommandName = &lt;span style="color: #006080;"&gt;"TestButton2"&lt;/span&gt; &lt;span style="color: blue;"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;         Response.Write(&lt;span style="color: #006080;"&gt;"This is DataList2"&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; &lt;span style="color: blue;"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;在我們按下&lt;b&gt;按鈕2&lt;/b&gt;後便可以正確觸發子DataList的I&lt;b&gt;temCommand&lt;/b&gt;事件&lt;b&gt;：&lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S7azRTYLgZI/AAAAAAAAMBA/bFYB64f-emw/s1600-h/2010-04-03_105109%5B6%5D.jpg"&gt;&lt;img alt="2010-04-03_105109" border="0" height="231" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S7azSFTD_XI/AAAAAAAAMBE/RQ_v5DP5wAw/2010-04-03_105109_thumb%5B2%5D.jpg?imgmax=800" style="border: 0px none; display: inline;" title="2010-04-03_105109" width="241" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-197170887349428474?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SCz-Vh85n_gztPWuG0U9KOwx-NA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SCz-Vh85n_gztPWuG0U9KOwx-NA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SCz-Vh85n_gztPWuG0U9KOwx-NA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SCz-Vh85n_gztPWuG0U9KOwx-NA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/KCvkAAom1wQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/197170887349428474/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/04/datalistdatalistdatalistitemcommand.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/197170887349428474" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/197170887349428474" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/KCvkAAom1wQ/datalistdatalistdatalistitemcommand.html" title="DataList包DataList中建立子DataList的ItemCommand事件" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_2sQfBxJU9mI/S7azSFTD_XI/AAAAAAAAMBE/RQ_v5DP5wAw/s72-c/2010-04-03_105109_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/04/datalistdatalistdatalistitemcommand.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-6452893686142039906</id><published>2010-03-20T15:16:00.001+08:00</published><updated>2010-03-20T15:18:10.273+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">Asp.Net的錨點(#連結)功能，支援FireFox</title><content type="html">&lt;p&gt;所謂錨點(#連結)的作法為超連結網址後方加上#參數。最常見的應用為指定回應內容網址的功能，讓使用者點擊回應連結後可直接將瀏覽器畫面定位在頁面下方的回應內容位置。&lt;br&gt;&lt;br&gt;錨點#的用法如下：&lt;br&gt;Ex：&lt;a href="http://localhost/Test/Test.aspx#Link"&gt;http://localhost/Test/Test.aspx#Link&lt;/a&gt;&lt;br&gt;如此我們就可以在被連結頁面中指定其連結位置&lt;br&gt;Ex：&lt;font color="#ff0000"&gt;&lt;strong&gt;&amp;lt;a id="Link"&amp;gt;&amp;lt;/a&amp;gt;&lt;br&gt;&lt;br&gt;&lt;/strong&gt;&lt;font color="#000000"&gt;上面這種寫法支持xhtml網頁標準，與傳統的錨點寫法&amp;lt;a name="#Link"&amp;gt;&amp;lt;/a&amp;gt;不同的是不使用name來指定錨點改用id指定且去掉了加上#字號。使用name一來會多了無意義的&amp;lt;a&amp;gt;連結，且未指定href也不符合xhtml標準，而使用id指定錨點不侷限於&amp;lt;a&amp;gt;標籤，可用於其它如&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;li&amp;gt;等標籤中。&lt;strong&gt;最重要的是使用id指定錨點才能讓Firefox、Opera、Chorm等瀏覽器作用！不再是IE Only的功能了。&lt;br&gt;&lt;/strong&gt;&lt;/font&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="#000000"&gt;下面用個簡單的連結範例來實作錨點功能：&lt;br&gt;在Test.aspx頁面建立HyperLink控制項，並指定其超連結網址為Test2.aspx，同時加上錨點參數#Link&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="background-color: #ffff00"&gt;&amp;lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #800000"&gt;DOCTYPE&lt;/span&gt; &lt;span style="color: #ff0000"&gt;html&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #0000ff"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="form1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:HyperLink&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="HyperLink1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;NavigateUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Test2.aspx#Link"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        錨點連結至Test2.aspx&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:HyperLink&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;並在Test2.aspx中建立1～15數字來區別位置，我們將錨點#Link建立在數字11上&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="background-color: #ffff00"&gt;&amp;lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test2.aspx.vb" Inherits="Test2" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #800000"&gt;DOCTYPE&lt;/span&gt; &lt;span style="color: #ff0000"&gt;html&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #0000ff"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="form1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    第一行&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    1&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    2&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    3&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    4&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    5&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    6&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    7&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    8&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    9&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    10&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Link"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    錨點連結點11&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    12&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    13&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    14&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    15&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;好了，現在我們輸入未指定錨點#連結的網址看看Test2.aspx中數字11的位置&lt;br&gt;&lt;a href="http://localhost/Test/Test2.aspx"&gt;http://localhost/Test/Test2.aspx&lt;/a&gt;，會發現數字11的位置在瀏覽器最下方。&lt;br&gt;&lt;a href="http://lh6.ggpht.com/_2sQfBxJU9mI/S6R2I-zqBDI/AAAAAAAAMAY/KDftGc9a3UM/s1600-h/2010-03-20_145109%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2010-03-20_145109" border="0" alt="2010-03-20_145109" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S6R2KBWV29I/AAAAAAAAMAc/ZxKbDBhErPY/2010-03-20_145109_thumb%5B1%5D.jpg?imgmax=800" width="259" height="743"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;現在再透過剛建立的Test.aspx上的HyperLink連結至Test2.aspx看看有何不同。HyperLink的超連結網址為&lt;a href="http://localhost/Test/Test2.aspx#Link"&gt;http://localhost/Test/Test2.aspx#Link&lt;/a&gt;，數字11的位置可以完整看見了，這就是錨點的用途很簡易實現。&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S6R2LSmlQbI/AAAAAAAAMAg/-6E0fB4b3Tg/s1600-h/2010-03-20_144849%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2010-03-20_144849" border="0" alt="2010-03-20_144849" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S6R2MSck-oI/AAAAAAAAMAk/KMVhZCLahQo/2010-03-20_144849_thumb%5B1%5D.jpg?imgmax=800" width="217" height="744"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-6452893686142039906?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/d7qRFZhXvLFGA1563xA4iP0mrC0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d7qRFZhXvLFGA1563xA4iP0mrC0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/d7qRFZhXvLFGA1563xA4iP0mrC0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d7qRFZhXvLFGA1563xA4iP0mrC0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/xTY-iFlPmi0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/6452893686142039906/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/03/aspnetfirefox.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6452893686142039906" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/6452893686142039906" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/xTY-iFlPmi0/aspnetfirefox.html" title="Asp.Net的錨點(#連結)功能，支援FireFox" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_2sQfBxJU9mI/S6R2KBWV29I/AAAAAAAAMAc/ZxKbDBhErPY/s72-c/2010-03-20_145109_thumb%5B1%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/03/aspnetfirefox.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-2973298738987533691</id><published>2010-03-16T21:13:00.001+08:00</published><updated>2010-03-16T21:13:37.680+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">DropDownList資料繫結後加入"請選擇"靜態項目</title><content type="html">&lt;p&gt;在Asp.Net的DropDownList控制項中，除了可以使用資料繫結(DataBind)的方式，也可使用靜態方式建立選項項目，亦可兩者同時建立。我們不用CodeBehind的寫法直接使用滑鼠完成DropDownList同時建立動態與靜態項目，一個很基礎又很實用的技巧記錄如下。&lt;br&gt;&lt;br&gt;首先必須將DropListBox中的&lt;strong&gt;&lt;font color="#ff0000"&gt;AppendDataBoundItems&lt;/font&gt;&lt;/strong&gt;屬性設定為&lt;strong&gt;True&lt;/strong&gt;，其功用如下方說明所示：&lt;em&gt;&lt;u&gt;將資料繫結項目附加至靜態宣告的清單項目&lt;/u&gt;&lt;/em&gt;。原來Vistual Studio都幫我們預先做好了，只要設定為Ture就可以。&lt;br&gt;&lt;a href="http://lh6.ggpht.com/_2sQfBxJU9mI/S5-D1Y4NtQI/AAAAAAAAL_8/63ye0RfjcHg/s1600-h/2010-03-16_210002%5B2%5D.jpg"&gt;&lt;strong&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-16_210002" border="0" alt="2010-03-16_210002" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S5-D3Ugks-I/AAAAAAAAMAA/qRp2a4o-Ezg/2010-03-16_210002_thumb.jpg?imgmax=800" width="239" height="234"&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;/strong&gt;接著將靜態項目加入DropDownList中，方法如下圖：&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S5-D4CTjbFI/AAAAAAAAMAE/wfAJytQwqTs/s1600-h/2010-03-16_210128%5B2%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-16_210128" border="0" alt="2010-03-16_210128" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S5-D5BQ34eI/AAAAAAAAMAI/wD6UJ5VWjus/2010-03-16_210128_thumb.jpg?imgmax=800" width="244" height="127"&gt;&lt;/a&gt; &lt;br&gt;&lt;a href="http://lh6.ggpht.com/_2sQfBxJU9mI/S5-D6QcFRdI/AAAAAAAAMAM/AlAnZ45CM-o/s1600-h/2010-03-16_210303%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-16_210303" border="0" alt="2010-03-16_210303" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S5-D7TPMQ-I/AAAAAAAAMAQ/8SuIB7mZSa0/2010-03-16_210303_thumb%5B1%5D.jpg?imgmax=800" width="503" height="339"&gt;&lt;/a&gt; &lt;br&gt;完成後的程式碼如下：&lt;br&gt;&amp;lt;asp:DropDownList ID="DropDownList" runat="server"&amp;nbsp; DataSourceID="SqlDataSource" DataTextField="Test1" DataValueField="Test2"&amp;nbsp; &lt;strong&gt;&lt;font color="#ff0000"&gt;AppendDataBoundItems="True"&lt;/font&gt;&lt;/strong&gt; &amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&lt;font color="#ff0000"&gt;&amp;lt;asp:ListItem Value="0"&amp;gt;請選擇&amp;lt;/asp:ListItem&amp;gt;&lt;br&gt;&lt;/font&gt;&lt;/strong&gt;&amp;lt;/asp:DropDownList&amp;gt;&lt;br&gt;&lt;/p&gt; &lt;p&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource" runat="server"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectionString="&amp;lt;%$ ConnectionStrings:TestConnectionString %&amp;gt;" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectCommand="Select * From Test"&amp;gt;&lt;br&gt;&amp;lt;/asp:SqlDataSource&amp;gt;&amp;nbsp;   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-2973298738987533691?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Hihx-3GwXRGfIYC2TNkt8iUIdpA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Hihx-3GwXRGfIYC2TNkt8iUIdpA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Hihx-3GwXRGfIYC2TNkt8iUIdpA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Hihx-3GwXRGfIYC2TNkt8iUIdpA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/wCDBK8Va17s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/2973298738987533691/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/03/dropdownlist.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2973298738987533691" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/2973298738987533691" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/wCDBK8Va17s/dropdownlist.html" title="DropDownList資料繫結後加入&amp;quot;請選擇&amp;quot;靜態項目" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_2sQfBxJU9mI/S5-D3Ugks-I/AAAAAAAAMAA/qRp2a4o-Ezg/s72-c/2010-03-16_210002_thumb.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/03/dropdownlist.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-4664219889253941541</id><published>2010-03-16T20:38:00.001+08:00</published><updated>2010-03-16T20:40:22.580+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">Class類別中的Response、Server、Request未宣告解決方法(使用HttpContext.Current屬性)</title><content type="html">&lt;p&gt;對於需要重複使用的程式碼，我們通常可以寫在Asp.Net的Public Class類別中，再到WebForm中呼叫。例如在Test.aspx.vb的Page Load中使用此段程式碼來判斷使用者是否已登入。&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; Page_Load(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Load&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; Server.HtmlEncode(Request.Cookies(&lt;span style="color: #006080"&gt;"UserInfo"&lt;/span&gt;)(&lt;span style="color: #006080"&gt;"Login"&lt;/span&gt;)) = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        Response.Redirect(&lt;span style="color: #006080"&gt;"Default.aspx"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;Else&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        Response.Redirect(&lt;span style="color: #006080"&gt;"Login.aspx"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;我們需要在每一個頁面都先進行使用者是否登入的判斷，因此將此區段程式碼取出寫在Public Class類別中提供給每個頁面呼叫。&lt;br&gt;&lt;br&gt;在Asp.Net中建立一個名為Class1.vb的類別，接著把上面的程式碼貼入Public Sub中會發現如下圖畫面中的錯誤：&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S5972GQLe0I/AAAAAAAAL_0/gLtm1Iv2idE/s1600-h/2010-03-16_201928%5B4%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2010-03-16_201928" border="0" alt="2010-03-16_201928" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S5973PP1fcI/AAAAAAAAL_4/4Bh8d151vTE/2010-03-16_201928_thumb%5B2%5D.jpg?imgmax=800" width="504" height="142"&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;在Class1.vb中出現&lt;strong&gt;Server、Request、Response&lt;/strong&gt;皆&lt;strong&gt;&lt;font color="#ff0000"&gt;未宣告&lt;/font&gt;&lt;/strong&gt;的錯誤訊息。&lt;br&gt;&lt;br&gt;因為&lt;strong&gt;Server、Request、Response&lt;/strong&gt;的預設值是Page，即Page.Server&lt;strong&gt;、&lt;/strong&gt;Page.Request、Page.Response。也就是說Page.Response的返回值是當前頁面的值，而在Class1.vb類別中無法得知當前頁面的值為何。&lt;br&gt;&lt;br&gt;因此需要透過Http從來源頁面中傳遞告知當前頁面為何，我們在每個錯誤訊息前面加上&lt;strong&gt;&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.web.httpcontext.current.aspx" target="_blank"&gt;HttpContext.Current&lt;/a&gt;&lt;/strong&gt;屬性：&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Imports&lt;/span&gt; Microsoft.VisualBasic&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt; Class1&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; Get_Cookie()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; HttpContext.Current.Server.HtmlEncode _&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        (HttpContext.Current.Request.Cookies(&lt;span style="color: #006080"&gt;"UserInfo"&lt;/span&gt;)(&lt;span style="color: #006080"&gt;"Login"&lt;/span&gt;)) = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            HttpContext.Current.Response.Redirect(&lt;span style="color: #006080"&gt;"Default.aspx"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;Else&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            HttpContext.Current.Response.Redirect(&lt;span style="color: #006080"&gt;"Login.aspx"&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Class&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;最後，將Test.aspx.vb的Page_Load改為Call呼叫的方式來使用Class1.vb類別&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; Page_Load(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Load&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; Class1 &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Class1&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;Call&lt;/span&gt; Class1.Get_Cookie()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-4664219889253941541?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Uk2jsyvQ53arfMf14ecWRUKukqY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Uk2jsyvQ53arfMf14ecWRUKukqY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Uk2jsyvQ53arfMf14ecWRUKukqY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Uk2jsyvQ53arfMf14ecWRUKukqY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/b6s41E1VNHA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/4664219889253941541/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/03/classresponseserverrequesthttpcontextcu.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/4664219889253941541" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/4664219889253941541" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/b6s41E1VNHA/classresponseserverrequesthttpcontextcu.html" title="Class類別中的Response、Server、Request未宣告解決方法(使用HttpContext.Current屬性)" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_2sQfBxJU9mI/S5973PP1fcI/AAAAAAAAL_4/4Bh8d151vTE/s72-c/2010-03-16_201928_thumb%5B2%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/03/classresponseserverrequesthttpcontextcu.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-5689876207218789168</id><published>2010-03-10T21:00:00.002+08:00</published><updated>2010-03-20T15:19:16.842+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">Alert視窗確認後Response.Redirect轉跳頁面的替代方法(含ScriptManager Ajax頁面轉跳方法)</title><content type="html">&lt;a href="http://lh6.ggpht.com/_2sQfBxJU9mI/S5eX31M7q1I/AAAAAAAAL_c/3G9rDkJhyC8/s1600-h/2010-03-10_194728%5B6%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-10_194728" border="0" alt="2010-03-10_194728" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S5eX46QNtTI/AAAAAAAAL_g/aU6kZpHawOE/2010-03-10_194728_thumb%5B4%5D.jpg?imgmax=800" width="359" height="115"&gt;&lt;/a&gt; &lt;br&gt;在Asp.net中，需要在操作例如送出動作時，先&lt;b&gt;&lt;i&gt;彈出確認視窗之後轉跳到指定頁面&lt;/i&gt;&lt;/b&gt;的功能其實是非常常見的。此功能的實作算是非常基礎的，很多剛開始嘗試寫Asp.Net的人直覺寫法是一段JavaScript語法加上Response.Redirect來實現：&lt;br&gt;&lt;b&gt;&lt;span style="color: black"&gt;Response.Write&amp;nbsp;&amp;nbsp; "&amp;lt;script &amp;gt;alert('更新成功！');&amp;lt;/script&amp;gt;"&lt;br&gt;Response.Redirect("Default.aspx")&lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;/b&gt;此種直覺的寫法在實際執行時會發現，Alert的警告視窗不出現就直接轉跳頁面到Default.aspx去了。我也寫過這種無法正確執行的程式碼，因而誤以為自己語法寫錯了。Alert視窗呢？回頭仔細檢查語法發現並沒有寫錯，為何不顯示Alert呢？&lt;br&gt;&lt;br&gt;這是因為Response.Redirect是在未送出HttpHead前便執行了，而JavaScript又是需要在Client端才能Run，也就是說用了Response.Redirect在返回Client端以前頁面就已經被轉向至Default.aspx，那麼原本頁面的Alert便無法執行了。&lt;br&gt;&lt;br&gt;瞭解原因後，就可以使用其它方法來替代Response.Redirect來實現轉跳的功能。在JavaScript語法中本身已有頁面轉跳的功能語法，因此我們將上面原本無法正確執行的兩行程式碼合併為一行：&lt;br&gt;&lt;b&gt;&lt;span style="color: black"&gt;Response.Write("&amp;lt;script&amp;gt;alert('修改成功!'); &lt;span style="color: red"&gt;location.href='Default.aspx';&lt;/span&gt; &amp;lt;/script&amp;gt;")&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;/b&gt;直接在Alert後使用location.href=』轉跳網址...』，如此便可避免因頁面已轉跳無法將JavaScript返回Client端執行的問題。&lt;br&gt;&lt;br&gt;另外一種情況為在頁面中使用了&lt;b&gt;ScriptManager&lt;/b&gt;來實現Ajax的頁面。含有Ajax功能的頁面若使用上述方法來轉跳頁面，會發現Alert視窗也無法正確顯示出來，需改為下列的程式碼：&lt;br&gt;&lt;b&gt;ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('修改成功!'); location.href='Default.aspx';", True)&lt;br&gt;&lt;br&gt;&lt;/b&gt;RegisterStartupScript類似Response.Write功能相仿，多了的Type與Key的參數。實際在顯示畫面的差別為，使用Response.Write時彈出的Alert視窗後面的頁面是空白的看不到任何頁面內容：&lt;br&gt;&amp;nbsp;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S5eX5xgtY2I/AAAAAAAAL_k/ok4lrhP_pdQ/s1600-h/2010-03-10_203629%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-10_203629" border="0" alt="2010-03-10_203629" src="http://lh6.ggpht.com/_2sQfBxJU9mI/S5eX7PAKn_I/AAAAAAAAL_o/cIQIBKMY34g/2010-03-10_203629_thumb%5B1%5D.jpg?imgmax=800" width="455" height="204"&gt;&lt;/a&gt;&amp;nbsp; &lt;br&gt;&lt;br&gt;使用RegisterStartupScript時彈出的Alert視窗後面的頁面內容是可見的：&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S5eX8nDepvI/AAAAAAAAL_s/urA09QDQ8WI/s1600-h/2010-03-10_203556%5B10%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-10_203556" border="0" alt="2010-03-10_203556" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S5eX9o8a_uI/AAAAAAAAL_w/1yWrgAjSb0Y/2010-03-10_203556_thumb%5B6%5D.jpg?imgmax=800" width="484" height="153"&gt;&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;span style="color: blue"&gt;補充：&lt;/span&gt;&lt;/b&gt;&lt;br&gt;不含ScriptManager Ajax功能頁面的RegisterStartupScript寫法：&lt;br&gt;&lt;b&gt;Page.ClientScript.RegisterStartupScript(Me.GetType(), "Test", "&amp;lt;script&amp;gt;alert('修改成功!');location.href='Default.aspx';&amp;lt;/script&amp;gt;")&lt;/b&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-5689876207218789168?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-vsuM62NU0xXjZRsUl2g63WInDA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-vsuM62NU0xXjZRsUl2g63WInDA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-vsuM62NU0xXjZRsUl2g63WInDA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-vsuM62NU0xXjZRsUl2g63WInDA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/ounxNgPtDsI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/5689876207218789168/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/03/alertresponseredirectscriptmanager-ajax.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/5689876207218789168" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/5689876207218789168" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/ounxNgPtDsI/alertresponseredirectscriptmanager-ajax.html" title="Alert視窗確認後Response.Redirect轉跳頁面的替代方法(含ScriptManager Ajax頁面轉跳方法)" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_2sQfBxJU9mI/S5eX46QNtTI/AAAAAAAAL_g/aU6kZpHawOE/s72-c/2010-03-10_194728_thumb%5B4%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/03/alertresponseredirectscriptmanager-ajax.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-8152659577683248370</id><published>2010-03-09T21:50:00.001+08:00</published><updated>2010-03-09T21:53:53.130+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">HyperLink使用Eval繫結資料庫傳遞QueryString值</title><content type="html">&lt;p&gt;要實作的功能為網站首頁最新公告欄位，我們想要透過點擊公告主題來進入詳情頁面(PostDetail.aspx)，如下圖：&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S5ZSFcfTgHI/AAAAAAAAL_U/VYLsibvqMek/s1600-h/2010-03-09_213050%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-03-09_213050" border="0" alt="2010-03-09_213050" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S5ZSGUCLgVI/AAAAAAAAL_Y/Ywukcgg4tNs/2010-03-09_213050_thumb%5B3%5D.jpg?imgmax=800" width="504" height="77"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;紅框處使用&lt;strong&gt;HyperLink&lt;/strong&gt;來繫結公告主題，而&lt;strong&gt;HyperLink&lt;/strong&gt;的NavigateUrl屬性我們要連結至詳情頁面(PostDetail.aspx)並使用QueryString傳值的方式來傳遞公告編號至詳情頁面。&lt;br&gt;&lt;br&gt;若是屬於GridView中的&lt;strong&gt;HyperLink&lt;/strong&gt;其傳遞QueryString的寫法是：PostDetail.aspx?公告編號={0}，其中{0}便是繫結了資料庫的公告編號，GridView等於自動幫你繫結好了。那麼，若是使用單獨的&lt;strong&gt;HyperLink&lt;/strong&gt;控制項，可以使用&lt;strong&gt;Eval&lt;/strong&gt;繫結寫法的方式來傳遞QueryString值。&lt;br&gt;&lt;br&gt;其寫法如下：&lt;br&gt;&amp;lt;asp:HyperLink ID="HyperLink" runat="server" &lt;br&gt;NavigateUrl=&lt;strong&gt;&lt;font color="#ff0000"&gt;'&amp;lt;%# "PostDetail.aspx?PostID=" &amp;amp; Eval("公告編號") %&amp;gt;'&lt;/font&gt;&lt;/strong&gt; &amp;gt;&lt;br&gt;&amp;lt;%# Eval("主題") %&amp;gt;&amp;lt;/asp:HyperLink&amp;gt;&lt;br&gt;&lt;br&gt;&lt;font color="#808080"&gt;※&amp;nbsp; 前提是別忘了先將欲繫結的資料欄位Select出來。&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-8152659577683248370?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jXe4fcraD_X4gxaWgf7U-bg-NUs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jXe4fcraD_X4gxaWgf7U-bg-NUs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jXe4fcraD_X4gxaWgf7U-bg-NUs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jXe4fcraD_X4gxaWgf7U-bg-NUs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/MAib101paOM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/8152659577683248370/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/03/hyperlinkevalquerystring.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8152659577683248370" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/8152659577683248370" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/MAib101paOM/hyperlinkevalquerystring.html" title="HyperLink使用Eval繫結資料庫傳遞QueryString值" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_2sQfBxJU9mI/S5ZSGUCLgVI/AAAAAAAAL_Y/Ywukcgg4tNs/s72-c/2010-03-09_213050_thumb%5B3%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/03/hyperlinkevalquerystring.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-5832966238671638959</id><published>2010-02-26T22:14:00.001+08:00</published><updated>2010-02-26T22:20:42.417+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">GridView中使用CommandArgument取得Button按哪一列(ListView同樣適用)</title><content type="html">&lt;p&gt;在Asp.net中Button有個非常好使用的屬性：&lt;font color="#ff0000"&gt;&lt;strong&gt;CommandArgument&lt;br&gt;&lt;/strong&gt;&lt;font color="#000000"&gt;MSDN對&lt;a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.button.commandargument%28VS.80%29.aspx" target="_blank"&gt;CommandArgument&lt;/a&gt;的解釋是：取得或設定選擇性 (Optional) 參數，與相關的 CommandName 一起傳遞至 Command 事件。&lt;/font&gt;&lt;br&gt;&lt;/font&gt;配合GridView、ListView使用起來可以實現判斷點擊Button是哪一列的功能。&lt;br&gt;&lt;br&gt;要實現判斷按了哪一列有許多種不同作法，使用Button的CommandArgument屬性只是其中之一，但是我個人覺得最方便也最直覺的設定方法。&lt;br&gt;&lt;br&gt;在 Visturl Studio 中可以使用滑鼠點擊方式來設定&lt;strong&gt;CommandArgument&lt;/strong&gt;的繫結，方式如下：&lt;br&gt;&lt;br&gt;此例在GridView中使用ButtonField設置了刪除按鈕，接著我們先將其轉換為&lt;strong&gt;TemplateField&lt;/strong&gt;模式以利我們後續自定一些設定。&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S4fXRq5SUAI/AAAAAAAAL-8/asZ5EnmtGcs/s1600-h/2010-02-26_213521%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-02-26_213521" border="0" alt="2010-02-26_213521" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S4fXSkddpSI/AAAAAAAAL_A/wuuczMslJJo/2010-02-26_213521_thumb%5B1%5D.jpg?imgmax=800" width="334" height="263"&gt;&lt;/a&gt; &lt;br&gt;&lt;br&gt;接著點擊GridView視覺化視窗中的小箭頭 &amp;gt; 進入&lt;strong&gt;編輯樣板&lt;/strong&gt;，找到欲設定的刪除按鈕後，再點擊小箭頭 &amp;gt; &lt;strong&gt;編輯DataBinding&lt;/strong&gt;。&lt;br&gt;&lt;a href="http://lh3.ggpht.com/_2sQfBxJU9mI/S4fXTvydQvI/AAAAAAAAL_E/Bou8wMh3X3Y/s1600-h/2010-02-26_213213%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-02-26_213213" border="0" alt="2010-02-26_213213" src="http://lh4.ggpht.com/_2sQfBxJU9mI/S4fXUoV2-NI/AAAAAAAAL_I/yfI8g67meWo/2010-02-26_213213_thumb%5B1%5D.jpg?imgmax=800" width="289" height="176"&gt;&lt;/a&gt; &lt;br&gt;&lt;br&gt;重要設定在此：在DataBindings設定視窗中，要選擇&lt;font color="#ff0000"&gt;&lt;strong&gt;CommandArgument&lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;來作資料繫結的動作。接著選取欄位繫結(F)下拉選取欲繫結的選項，通常必須選擇作為等下要設定為SQL Delete 語法 Where 條件的選項。(若一開始無法選擇欄位繫結，點擊下方重新整理結構描述後即可)&lt;/font&gt;&lt;br&gt;&lt;a href="http://lh5.ggpht.com/_2sQfBxJU9mI/S4fXWOTdJ5I/AAAAAAAAL_M/I3J441ZJ2mg/s1600-h/2010-02-26_213417%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-02-26_213417" border="0" alt="2010-02-26_213417" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S4fXXLktj9I/AAAAAAAAL_Q/MmEu0DSjA4Q/2010-02-26_213417_thumb%5B2%5D.jpg?imgmax=800" width="504" height="369"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;設定完成後，GridView中刪除按鈕便會多了&lt;strong&gt;CommandArgument='&amp;lt;%# Eval("拜訪編號") %&amp;gt;'&lt;/strong&gt;這行程式碼。&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:TemplateField&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ShowHeader&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="False"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:Button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Button2"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CausesValidation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="False"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #ff0000"&gt;CommandName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Delete_VI"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="刪除"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #ff0000"&gt;OnClientClick&lt;/span&gt; = &lt;span style="color: #0000ff"&gt;"if (confirm('您確定要刪除嗎?')==false) {return false;}"&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #ff0000"&gt;CommandArgument&lt;/span&gt;&lt;span style="color: #0000ff"&gt;='&amp;lt;%# Eval("拜訪編號") %&amp;gt;'&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:TemplateField&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;最後在aspx.vb中以CodeBehind方式撰寫SQL的Delete程式碼：&lt;br&gt;由於GridView中可能不只存在一個按鈕，因此必須先在&lt;strong&gt;GridView_RowCommand&lt;/strong&gt;事件中先行判斷點擊的是刪除按鈕，之後才接著執行刪除的SQL動作。&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; GridView_RowCommand(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Web.UI.WebControls.GridViewCommandEventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; GridView.RowCommand&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; e.CommandName = &lt;span style="color: #006080"&gt;"Delete_VI"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; strSQL &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; Cmd &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; SqlCommand&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;Try&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                strSQL = &lt;span style="color: #006080"&gt;"Delete 拜訪目的 Where 拜訪編號=@拜訪編號 "&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd = &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; SqlCommand(strSQL, conn)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.Parameters.Add(&lt;span style="color: #0000ff"&gt;New&lt;/span&gt; SqlParameter(&lt;span style="color: #006080"&gt;"@拜訪編號"&lt;/span&gt;, SqlDbType.Int))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.Parameters(&lt;span style="color: #006080"&gt;"@拜訪編號"&lt;/span&gt;).Value = e.CommandArgument&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.Connection.Open()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.ExecuteNonQuery()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.Cancel()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Cmd.Connection.Close()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                conn.Dispose()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                VI_GridView.DataBind()&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;Catch&lt;/span&gt; ex &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; Exception&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Response.Write(ex.Message)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Try&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;其中，在SQL的Where條件使用了&lt;strong&gt;&lt;font color="#ff0000"&gt;e.CommandArgument&lt;/font&gt;&lt;/strong&gt;來取得繫結在CommandArgument上的資料作為刪除條件，即可實現在GridView刪除點擊那一列的功能。&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;補充：&lt;br&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;在ListView中使用&lt;strong&gt;CommandArgument&lt;/strong&gt;實現判斷Button點擊哪一列功能與GridView設定相同。唯一不同之處是ListView將Button的CommandName 傳遞至ItemCommand中，因此我們只需要將e.CommandArgument改寫在ItemCommand事件中即可。&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-5832966238671638959?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/j7hF7nnKzMQkzs3eNlyLp04twdo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j7hF7nnKzMQkzs3eNlyLp04twdo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/j7hF7nnKzMQkzs3eNlyLp04twdo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j7hF7nnKzMQkzs3eNlyLp04twdo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/1Tuicz__HCw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/5832966238671638959/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/02/gridviewcommandargumentbuttonlistview.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/5832966238671638959" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/5832966238671638959" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/1Tuicz__HCw/gridviewcommandargumentbuttonlistview.html" title="GridView中使用CommandArgument取得Button按哪一列(ListView同樣適用)" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_2sQfBxJU9mI/S4fXSkddpSI/AAAAAAAAL_A/wuuczMslJJo/s72-c/2010-02-26_213521_thumb%5B1%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/02/gridviewcommandargumentbuttonlistview.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-2893139382062216061.post-9149955757000351916</id><published>2010-02-25T21:17:00.001+08:00</published><updated>2010-02-25T21:24:12.274+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title type="text">CodeBehind方式設定GridView欄寬、置中</title><content type="html">&lt;p&gt;使用GridView中內建的編輯功能預設是沒有設定欄寬的，因此會造成編輯時的TextBox將欄位撐開的問題：&lt;br&gt;&lt;a href="http://lh4.ggpht.com/_2sQfBxJU9mI/S4Z4T_sqFDI/AAAAAAAAL-U/KHzm99S_tcM/s1600-h/2010-02-25_205559%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-02-25_205559" border="0" alt="2010-02-25_205559" src="http://lh5.ggpht.com/_2sQfBxJU9mI/S4Z4U7UHRGI/AAAAAAAAL-Y/5tNIGTNPrkM/2010-02-25_205559_thumb%5B1%5D.jpg?imgmax=800" width="345" height="123"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;在GridView的&lt;strong&gt;RowDataBound&lt;/strong&gt;事件中以CodeBehind設定欄位寬度與文字置中：&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; GridView_RowDataBound(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Web.UI.WebControls.GridViewRowEventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; GridView.RowDataBound&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;'設定欄位寬度&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp; GridView.Columns(1).ItemStyle.Width = 80&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        GridView.Columns(1).ControlStyle.Width = 80&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;'設定文字置中&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&amp;nbsp; GridView.Columns(1).ItemStyle.HorizontalAlign = HorizontalAlign.Center&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;ItemStyle.Width&lt;/strong&gt;：普通模式欄位寬度&lt;br&gt;&lt;strong&gt;ControlStyle.Width&lt;/strong&gt; ：編輯模式欄位寬度&lt;br&gt;&lt;br&gt;設定後結果：&lt;br&gt;&lt;a href="http://lh5.ggpht.com/_2sQfBxJU9mI/S4Z4Vms8m_I/AAAAAAAAL-c/qGzgS-iH1Mc/s1600-h/2010-02-25_205627%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="2010-02-25_205627" border="0" alt="2010-02-25_205627" src="http://lh3.ggpht.com/_2sQfBxJU9mI/S4Z4WnRGTVI/AAAAAAAAL-g/Hj_c3tAFgB4/2010-02-25_205627_thumb%5B1%5D.jpg?imgmax=800" width="276" height="123"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;補充：&lt;br&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;以For迴圈方式設定GridView中所有欄位寬度&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; GridView_RowDataBound(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Web.UI.WebControls.GridViewRowEventArgs) &lt;span style="color: #0000ff"&gt;Handles&lt;/span&gt; GridView.RowDataBound&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; i &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;For&lt;/span&gt; i &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt; = 0 &lt;span style="color: #0000ff"&gt;To&lt;/span&gt; GridView.Columns.Count - 1&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GridView.Columns(i).ItemStyle.Width = 80&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;Next&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2893139382062216061-9149955757000351916?l=tgw1029.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/O3Ozd7ppEOMAkHJf-GNWZ6H9Xw8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O3Ozd7ppEOMAkHJf-GNWZ6H9Xw8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/O3Ozd7ppEOMAkHJf-GNWZ6H9Xw8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O3Ozd7ppEOMAkHJf-GNWZ6H9Xw8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/tgw1029/~4/zj93T489ug4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://tgw1029.blogspot.com/feeds/9149955757000351916/comments/default" title="張貼意見" /><link rel="replies" type="text/html" href="http://tgw1029.blogspot.com/2010/02/codebehindgridview.html#comment-form" title="0 個意見" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/9149955757000351916" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2893139382062216061/posts/default/9149955757000351916" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/tgw1029/~3/zj93T489ug4/codebehindgridview.html" title="CodeBehind方式設定GridView欄寬、置中" /><author><name>威筆記</name><uri>http://www.blogger.com/profile/03781053564980189303</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_2sQfBxJU9mI/S4Z4U7UHRGI/AAAAAAAAL-Y/5tNIGTNPrkM/s72-c/2010-02-25_205559_thumb%5B1%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://tgw1029.blogspot.com/2010/02/codebehindgridview.html</feedburner:origLink></entry></feed>

