摘要: Visual Studio 寫程式視窗的預設值是白色背景,我個人是偏好使用暗色背景,長時間盯著眼睛比較舒服,但調成暗色背景之後還要自行調整程式碼的顏色,實在有點麻煩,所以上網找了一下,找到了 Studio Styles 這個好網站,網站裡面有許多熱心分享的朋友分享他們自訂的佈景,各位朋友也過去挑一個吧! Studio Styles 網址:http://studiostyl.es/ 我正在使... 阅读全文
posted @ 2012-06-06 12:28 yuanlin 阅读(236) 评论(0) 推荐(0) 编辑
摘要: // 要加上這兩個命名空間using System.Web.UI.WebControls;using System.Web.UI.HtmlControls; public partial class countdown : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { ... 阅读全文
posted @ 2012-06-04 14:09 yuanlin 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 在使用 GridView 編輯功能時,按下編輯按鈕後會從新讀取頁面並跳到最上方,使用者必須在將畫面拉到欲編輯的地方,非常不方便,要解決這個問題,只要在 .aspx 的檔案最上方加上 MaintainScrollPositionOnPostback=”true” 即可。 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Defa... 阅读全文
posted @ 2012-06-04 14:08 yuanlin 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 今天看書的時候看到書的作者使用 StringBuilder 的 Append 來串接字串,一開始我的疑惑是「怎麼不用"+"」的就好呢?於是上網查了一些資料。 在 Jouni Heikniemi 這篇文章: .net String vs. StringBuilder – concatenation performance 中提到在大於「八次」字串的串接,程式的執行效率會有明顯的差異,所以... 阅读全文
posted @ 2012-06-04 14:03 yuanlin 阅读(316) 评论(1) 推荐(0) 编辑
摘要: // 要加上 using System.WebHttpBrowserCapabilities hbc = Request.Browser;Response.Write(hbc.Browser.ToString() + "<br/>"); //取得瀏覽器名稱Response.Write(hbc.Version.ToString() + "<br/>"); //取得瀏覽器版本號Response.Wri... 阅读全文
posted @ 2012-06-04 14:01 yuanlin 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 陣列宣告 int[] ArrayName = new int[指定大小];陣列排序 Array.Sort(欲排序的陣列);陣列搜尋 Array.BinarySearch(陣列名稱, 要找的元素) // 用 Binary Search, 需先 Sort Array.IndexOf(陣列名稱, 要找的元素) // 用 Linear Search* 找到會顯示元素的位置,沒找到會顯示負... 阅读全文
posted @ 2012-06-04 10:59 yuanlin 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 之前用 FileUpload 寫東西給人用的時候才發現上傳檔案的限制為 4MB,如果想要修改就必須到 web.config 來修改。 在 web.config 裡加入 <httpruntime maxrequestlength="8192">// 這裡是限制可上傳 8MB 的檔案參考資料: httpRuntime 項目 (ASP.NET 設定結構描述) 設定 ASP.NET 檔案上傳的大... 阅读全文
posted @ 2012-06-04 10:56 yuanlin 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 用 FileUpload 來作上傳檔案的動作並且可過濾上傳檔案類別 protected void FileUploadButton_Click(object sender, EventArgs e){ Boolean FileOK = false; string FilePath = "D:\\upload\\"; //設定上傳的路徑 //if (FileUploadF... 阅读全文
posted @ 2012-06-04 10:54 yuanlin 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 可以用 FormsAuthentication.HashPasswordForStoringInConfigFile 方法來作 string HashString = FormsAuthentication.HashPasswordForStoringInConfigFile(txtBeforeHash.Text, "MD5"); //可選用MD5 or SHA1txtAfterHash.Tex... 阅读全文
posted @ 2012-06-01 12:13 yuanlin 阅读(416) 评论(2) 推荐(0) 编辑