略過巡覽連結。
略過巡覽連結      
  dataform動態欄位隱藏,顯示 觀看回應

$("#dataFormMaster_FieldName").parent().parent().show();



$("#dataFormMaster_FieldName
").parent().parent().hide();






  進入畫面直接開啟dataform編輯,寫在datagrid onloadsuccess 觀看回應

$('#dataGridView').find('.info-datagrid').datagrid('insertRow');






  JQ統計圖表使用LoadData方式 觀看回應

//X軸為年月,Y軸為百分比為例



var  percent = [];//ex: ['20','50','70'']



var  yearmonth = [];//ex: ['201701','201702'','201703']



//PLOTID,LineChart為例



var plot1 = $.jqplot('JQLineChart1', [percent],//百分比 {



title: 'TAT Target', //PLOTTitle



seriesDefaults: {



pointLabels: { show: true }



},



axes: {



xaxis: {//X



renderer:
$.jqplot.CategoryAxisRenderer,



ticks: yearmonth //年月



},



yaxis: {//Y



min: 0, //刻度最小值



max: 100, //刻度最大值                                



}



}                       



});



plot1.replot();//重製圖表


  資料來源使用LoadData方式的Grid匯出Excel方法 觀看回應

.ASPX部分:



//toolitemonclick事件



function exportlocal() {



     var datagrid = $('#JQDataGrid7');//要匯出EXCELGRID ID



     var exportFields = [];



     var fields =
datagrid.datagrid(
'getColumnFields', true);



      for (var i = 0; i <
fields.length; i++) {



               
exportFields.push({ field: fields[i], title: datagrid.datagrid(
'getColumnOption',
fields[i]).title });



            }



            fields
= datagrid.datagrid(
'getColumnFields');



      for (var i = 0; i <
fields.length; i++) {



                exportFields.push({
field: fields[i], title: datagrid.datagrid(
'getColumnOption', fields[i]).title });



            }



  var rows = $('#JQDataGrid7').datagrid('getRows');//要匯出EXCELGRID ID



           
$.ajax({



               
type:
"POST",



                data:
{ mode:
'export',
fields: $.toJSONString(exportFields), rows: $.toJSONString(rows) },



               
cache:
false,



               
async:
false,



               
success:
function (data) {



                   
window.open(
'../handler/JqFileHandler.ashx?File=' + data, 'download');



                }



            });



       
}



.cs部分



funtion



public override void ProcessRequest(HttpContext context)



    {



        if (!JqHttpHandler.ProcessRequest(context))



        {



            base.ProcessRequest(context);



        }



   
}



改為



public override void ProcessRequest(HttpContext context)



    {



        if
(context.Request.Form[
"mode"] == "export")



        {



           
Export(context);



        }



        else if (!JqHttpHandler.ProcessRequest(context))



        {



            base.ProcessRequest(context);



        }



   
}



//新增下面的funtion



private void Export(HttpContext context)



    {



        var exportTable = new System.Data.DataTable();



 



        var fields =
(Newtonsoft.Json.Linq.
JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(context.Request.Form["fields"]);



        var rows =
(Newtonsoft.Json.Linq.
JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(context.Request.Form["rows"]);



        foreach
(Newtonsoft.Json.Linq.
JObject field in fields)



        {



            var columnType = typeof(string);



            if (rows.Count > 0)



            {



                var obj = rows[0] as
Newtonsoft.Json.Linq.
JObject;



                var value = obj[(string)field["field"]];



                if (value.Type ==
Newtonsoft.Json.Linq.
JTokenType.Integer)



                {



                   
columnType =
typeof(int);



                }



                else if (value.Type ==
Newtonsoft.Json.Linq.
JTokenType.Float)



                {



                   
columnType =
typeof(double);



                }



            }



           
exportTable.Columns.Add(
new System.Data.DataColumn((string)field["field"], columnType) { Caption = (string)field["title"] });



        }



        foreach
(Newtonsoft.Json.Linq.
JObject row in rows)



        {



            var dataRow =
exportTable.NewRow();



            foreach (var column in row)



            {



                if
(exportTable.Columns.Contains(column.Key))



                {



                   
dataRow[column.Key] = column.Value.ToString();



                }



            }



           
exportTable.Rows.Add(dataRow);



        }



 



        var fileName = string.Format("{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));



        var path = string.Format("../Files/{0}",
fileName);



        JQUtility.ExportToExcel(exportTable,
HttpContext.Current.Server.MapPath(path),
"", new List<string>());



       
context.Response.ContentType =
"text/plain";



       
context.Response.Write(fileName);



   
}



 






  GRID雙數欄位底色變斑馬效果 觀看回應

     <style>



        .datagrid-btable:nth-child(even){



            background-color:azure;



        }



    </style>