在HTML页面中调用aspx函数 [英] Call aspx function in HTML page
本文介绍了在HTML页面中调用aspx函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用jquery datatable并尝试从aspx页面调用jquery datatable中的函数,但无法从该函数绑定数据表。 br />
请帮助..
以下是我的jquery代码
Hello all,
I am using jquery datatable and try to call function in jquery datatable from aspx page but cannot be able to bind datatable from that function .
Please help..
Following is my jquery Code
$(document).ready(function () {
if ($.fn.dataTable.isDataTable('#example')) {
t.destroy();
}
t = $("#example").DataTable({
processing: true,
serverSide: true,
info: true,
paging: true,
searching: true,
ajax: {
url: 'Search.aspx/BindDatatable',
data: function (data) {
delete data.columns;
}
},
columns: [
{ "data": "LibCode" },
{ "data": "LibName" },
{
"render": function (data, type, full, meta) {
return '<a class="btn btn-warning" onClick="editdata(' + full.LibCode + ',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\')" href="javascript://">Edit</a> <a class="btn btn-danger" onClick="deletePhantom(' + full.LibCode + ',\'DELETE\')" href="javascript://">Remove</a>';
}
}
],
order: [[0, 'desc']],
select: true,
dom: 'lfrtip',
responsive: true,
buttons: true
});
t.on('order.dt search.dt', function () {
t.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
});
和我的aspx函数是
and My aspx function is
[System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()]
public static List<LibDetails> BindDatatable()
{
return PopulateCombo.BindDatatable();
}
我的尝试:
请使用搜索和分页选项发送jquery数据表的任何其他代码
What I have tried:
Please send any other code for jquery datatable with search and paging option
推荐答案
( document )。ready( function (){
if (
(document).ready(function () { if (
.fn.dataTable.isDataTable(' #example')){
t.destroy();
}
t =
.fn.dataTable.isDataTable('#example')) { t.destroy(); } t =
( #example)。DataTable({
处理: true ,
serverSide: true ,
info: true ,
paging: true ,
搜索: true ,
a jax:{
url:' Search.aspx / BindDatatable',
data : function (data){
delete data.columns;
}
},
栏:[
{ data : LibCode},
{ data: LibName},
{
render:< span class =code-keyword> function (data,type,full,meta){
return ' < a class =btn btn-warningonClick =editdata(' + full.LibCode + ' ,\'' + full.LibCode + ' \',\'' + full.LibCod e + ' \',\'' + full.LibCode + ' \',\'' + full.LibCode + ' \',\'' + full.LibCode + ' \')href =javascript://>编辑< / a>& nbsp;& nbsp;< a class =btn btn-dangeronClick =deletePhantom(' + full.LibCode + ' ,\'DELETE\')href =javascript:// >删除< / A>'跨度>;
}
}
],
订单:[[ 0 , ' desc']],
select: true ,
dom:' lfrtip',
responsive: true ,
按钮: true
});
t.on(' order.dt search.dt', function (){
t.column( 0 ,{search: ' applied',订单:' 已应用'})。nodes()。each( function (cell,i){
cell.innerHTML = i + 1 ;
});
})。draw();
});
("#example").DataTable({ processing: true, serverSide: true, info: true, paging: true, searching: true, ajax: { url: 'Search.aspx/BindDatatable', data: function (data) { delete data.columns; } }, columns: [ { "data": "LibCode" }, { "data": "LibName" }, { "render": function (data, type, full, meta) { return '<a class="btn btn-warning" onClick="editdata(' + full.LibCode + ',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\')" href="javascript://">Edit</a> <a class="btn btn-danger" onClick="deletePhantom(' + full.LibCode + ',\'DELETE\')" href="javascript://">Remove</a>'; } } ], order: [[0, 'desc']], select: true, dom: 'lfrtip', responsive: true, buttons: true }); t.on('order.dt search.dt', function () { t.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) { cell.innerHTML = i + 1; }); }).draw(); });
和我的aspx函数是
and My aspx function is
[System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()]
public static List<LibDetails> BindDatatable()
{
return PopulateCombo.BindDatatable();
}
我的尝试:
请使用搜索和分页选项发送jquery数据表的任何其他代码
What I have tried:
Please send any other code for jquery datatable with search and paging option
这篇关于在HTML页面中调用aspx函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文