Telerik前陣子放出消息,表示支援Telerik Extensions for ASP.NET MVC只到明年(2013 Q3),
而最大更新差不多就停留在目前的2012 Q2,之後版本多是修正bug和提升performance
取而代之的是這套Kendo UI Complete for ASP.NET MVC,今年7月已推出正式版,
簡單來說就是Kendo UI=CSS 3 + Html 5 + Javascript,以現階段版本還比不上Telerik的完善,開發文件也不盡完全,還不用急著升級
但未來若要朝MVC 4升級,可能要考慮轉用這套(Telerik Extensions for ASP.NET MVC只支援到MVC 3),另外Kendo對REST也提供比較好的支援,以微軟將推出的.Net Framework 4.5來看也是有此趨勢。
其他參考資訊
官方對一些疑慮的釐清
從Telerik升級到Kendo
Kendo UI Complete for ASP.NET MVC
使用jQuery傳遞Array
之前寫過一篇善用JavaScriptSerializer處理JSON資料,這次要傳遞的資料比較簡單,不是string就是List< string>,想當然爾會直覺地在前端用Array處理~方便咩。
JavaScript的Array長這樣
var myList = new Array();
最常見的用法就是把網頁上表單形式的排列資料,依所需取出以組合成陣列,
像是把table裡面每個的id值取出來
$('#myTable tr').each(function () {
var myId = $(this).attr('id');
myList.push( myId );
})
var myList = new Array();
最常見的用法就是把網頁上表單形式的排列資料,依所需取出以組合成陣列,
像是把table裡面每個的id值取出來
$('#myTable tr').each(function () {
var myId = $(this).attr('id');
myList.push( myId );
})
接著用$.post把資料往後送(我用MVC所以會有個Action接收)
$.post('myController/myAction', { json1: $.trim($('#textbox1').val()), json2: myList }, null, "json");
myAction如下
[HttpPost]
public JsonResult myAction (string json1, List< string> json2)
{
// do something
}
經過反覆檢驗,myList的確有值但json2總是null
解決辦法是traditional設為true,寫法有以下二種
● $.ajax設定traditional: true
$.ajax({
type: "POST",
url: 'myController/myAction',
data: { json1: $.trim($('#textbox1').val()), json2: myList },
null,
dataType: "json",
traditional: true
// traditional 改為 ture .NET 才能成功接收陣列
});
$.post('myController/myAction', $.param(myObject, true), null, "json");
參考資料
jQuery.param()
How can I post an array of string to ASP.NET MVC Controller without a form?
$.post('myController/myAction', { json1: $.trim($('#textbox1').val()), json2: myList }, null, "json");
myAction如下
[HttpPost]
public JsonResult myAction (string json1, List< string> json2)
{
// do something
}
經過反覆檢驗,myList的確有值但json2總是null
解決辦法是traditional設為true,寫法有以下二種
● $.ajax設定traditional: true
$.ajax({
type: "POST",
url: 'myController/myAction',
data: { json1: $.trim($('#textbox1').val()), json2: myList },
null,
dataType: "json",
traditional: true
// traditional 改為 ture .NET 才能成功接收陣列
});
● $.post傳值必須使用jQuery.param
var myObject = { json1: $.trim($('#textbox1').val()), json2: myList };$.post('myController/myAction', $.param(myObject, true), null, "json");
參考資料
jQuery.param()
How can I post an array of string to ASP.NET MVC Controller without a form?
訂閱:
文章 (Atom)