December 27, 2011

[MVC3] jQuery Ajax+JSON (後端程式C#)

網頁:jQuery+ajax取得Controller所送過來的後端資訊(JSON)
後台:MVC架構,利用Controller取得物件資訊並轉換成JSON format回傳至網頁
   
網頁前端程式1:
透過ajax送出{欄位:參數}資訊至Controller端
取得result值(JSON Format)後,透過timetable轉成Html格式課表

  $.ajax({


December 19, 2011

[jQuery]無法觸發 Ajax 動態載入html 事件

jQuery載入動態html table內容到網頁後,載入內容的hover或是click等事件無法觸發

原寫法(一般寫法): 

 $("#button").click(function () {
   
to do something...
  
});


November 1, 2011

[SQL] 補0 和 補空白

補0 和 補空白 常用在匯出需要固定欄位格式的csv格式檔案中

以下為例

欄位名稱:sd_birthday  
欄位說明:生日
欄位格式:YYYY/MM/DD


August 22, 2011

[mvc] 指定 Html.TextBoxFor 預設值 或 回傳值

View Engine:Razor


@model MyData
@Html.TextBoxFor(model  => model .myfield)




August 20, 2011

[mvc] Action或RouteUrl產生url連結

veiw engine:Razor

希望透過 Action 或 RouteUrl 產生url連結時:

@Url.Action("Index", "Home")
@Url.RouteUrl("Default", new {controller="Home", action="Index"}) 

如果需產生 "http://" 開頭的絕對位置:


August 20, 2011

[mvc] Html.ActionLink 套用 CSS

需求:Html.ActionLink 套用 CSS classes
view engine:razor

@Html.ActionLink("連結文字", "Contronller", "Action", new { }, new {@class="css的class名稱"})

html顯示如下:

< a herf="/Controller/Action" class="css的class名稱">連結文字< / a>


August 18, 2011

[.net] VS2010 嘗試載入 Crystal Reports執行階段時發生錯誤

VS 版本 :VS2010
CR 版本 :Crystal Report 2008 Runtime SP3
作業系統:win7 (64位元)

動機說明: 將原 VS2008的Window Form程式移至VS2010
錯誤訊息:「Crystal Report 登錄機碼權限不足 或 Crystal Reports 執行階段未正確安裝。」



July 31, 2011

[jquery] 透過 Google API 取得 jquery 的 libraries

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
google
.load("jquery", "1.6.2"
);
</script>

可手動更換jquery的版本
google.load("jquery", "1.6.2"); 
google api會載入以下lib
path: https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
path(u): https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js