2012年12月25日 星期二

軟體版本管理-TortoiseSVN-建立要管制的專案

1.到原廠網站下載安裝,若要使用中文,可另外下載中文包來安裝

2. 建立檔案庫,用來存放版本管理記錄:

3.建立要控管的專案目錄:未來將需要控管的程式主目錄放這邊

4.將程式專案放入控管區

5.操作範例:




6.更新,將異動記錄傳送到檔案庫:




2012年12月18日 星期二

GridView+Master Detail+Update


利用2個GridView做的Master Detail,每次選取GridView1的項目、顯示第2個GridView時會畫面閃爍,可利用AJAX的UpdatePanel元件達到不閃爍的目的,但使用UpdatePanel元件的缺點如下:

http://www.runpc.com.tw/content/content.aspx?id=104017

使用說明:
1.放入GridView1、SqlDataSource1,設定相關資料

2.放入ScriptManager物件

3.放入UpdatePanel,將GridView2放在UpdatePanel裡面、設定相關資料

4.UpdatePanel的Triggers屬性的ControlID加入GridView1、EvenName加入SelectedIndexChanged

2012年12月3日 星期一

用JavaScript中斷程式執行

需求:

若畫面上有一TextBox未填,使用者按下Button後,系統發出警告、不予處理。

方法一,用 RegularExpressionValidator物件
方法二, 用JavaScript,範例:
1.
<asp:button id="Button2" runat="server" onclick="Button2_Click" Text="PDF" OnClientClick="if(NoData()==false){return false;}"/>
2.
script type="text/javascript">

<function NoData() {
    alert("Please Fill The Data");
    return false;
}
</script>

2012年11月27日 星期二

Javascript Debug for IE

1.在Javascript裡面加入 debugger

function PanelVisible() {
    debugger;
    document.getElementById("div1").style.visibility = "visible";
}

2.IE 的 [工具] / [網際網路選項] –> [進階] 並取消勾選「停用指令碼除錯 (Internet Explorer)」

3.程式執行到debugger會停留在這邊,按F11作 Debug

2012年11月18日 星期日

GridView To PDF

嚴格的說,不是將GridView資料轉出到PDF,應該是說將網頁資料轉出到PDF,包含GridView,goole資料普遍都是利用免費的 iTextSharp Library達成目的,安裝方法不外乎就是下載dll檔,掛載到VS專案,程式表頭把相關參考加到Using。
使用過程遇到的案例參考:

1.這邊有詳細操作教學 http://danatang.blog.ntu.edu.tw/


2.中文問題,也可以參考 http://renjin.blogspot.tw/2009/01/using-chinese-fonts-in-itextsharp.html


2012年11月14日 星期三

Install AJAX Control Tool Kit at VS 2010 Express

1.At VS2010 -> Tool -> Extend Management 



2.Search NuGet Package Manager and Install.
   After install,restart VS2010

3.Open NuGet Package Manager 

4.Search AJAX and Install


Done

2012年11月5日 星期一

將文字轉出條碼

參考來源:
http://www.techrepublic.com/blog/howdoi/how-do-i-generate-barcodes-using-c/173

1.建立將文字轉條碼的類別

public static Bitmap CreateBarcode(string sData)
    {
        //create Bitmap物件
        Bitmap barcode = new Bitmap(1, 1);

        //設定條碼字型
        Font threeOfNine = new Font("Free 3 of 9", 60, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);

        //create圖形物件、載入Barcode字型
        Graphics graphics = Graphics.FromImage(barcode);

        //設定轉出條碼後的寬度、高度及字型
        SizeF datasize = graphics.MeasureString(sData, threeOfNine);

        //now we base the bitmap's size off of this data
        barcode = new Bitmap(barcode, datasize.ToSize());

        //依據更新後的bitmap刷新圖型物件
        graphics = Graphics.FromImage(barcode);

        //設定圖型物件背景顏色
        graphics.Clear(Color.White);

        //設定圖型物件的關聯文字的呈現模式為 SingleBitPerPixel
        //graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
        graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
       
        //將字串資料放入圖型物件
        graphics.DrawString(sData, threeOfNine, new SolidBrush(Color.Black), 0, 0);

        //圖型物件刷新
        graphics.Flush();

        //釋放物件
        threeOfNine.Dispose();
        graphics.Dispose();

        //回傳
        return barcode;
    }

2.畫面放一個Button、TextBox,Button事件裡面

        Bitmap barcode = HClass1.CreateBarcode("*" + TextBox1.Text + "*");
        barcode.Save(@"c:\barcode.gif", System.Drawing.Imaging.ImageFormat.Gif);