// Call template init (optional, but faster if called manually)
$.template.init();
// Progress
$('.demo-progress').progress();
// Table sort - DataTables
var table = $('#sorting-advanced');
table.dataTable({
'aoColumnDefs': [
{ 'bSortable': false, 'aTargets': [0, 5] }
],
'sPaginationType': 'full_numbers',
'sDom': '<"dataTables_header"lfr>t<"dataTables_footer"ip>',
'fnInitComplete': function (oSettings) {
// Style length select
table.closest('.dataTables_wrapper').find('.dataTables_length select').addClass('select blue-gradient glossy').styleSelect();
tableStyled = true;
}
});
// Table sort - styled
$('#sorting-advanced').tablesorter({
headers: {
0: { sorter: false },
5: { sorter: false }
}
}).on('click', 'tbody td', function (event) {
// Do not process if something else has been clicked
if (event.target !== this) {
return;
}
var tr = $(this).parent(),
row = tr.next('.row-drop'),
rows;
// If click on a special row
if (tr.hasClass('row-drop')) {
return;
}
// If there is already a special row
if (row.length > 0) {
// Un-style row
tr.children().removeClass('anthracite-gradient glossy');
// Remove row
row.remove();
return;
}
// Remove existing special rows
rows = tr.siblings('.row-drop');
if (rows.length > 0) {
// Un-style previous rows
rows.prev().children().removeClass('anthracite-gradient glossy');
// Remove rows
rows.remove();
}
// Style row
tr.children().addClass('anthracite-gradient glossy');
var selectedCertificate = getValue();
// Add fake row
$('' +
' + tr.children().length + '">' +
'' +
' +
'' +
'Send mail' +
'' +
' +
'' +
'Remove' +
'' +
'' +
'Certificate Number: ' + selectedCertificate + '
' +
'Area: ' + +'
' + function(selectedCertificate, condition)
'Email:
' + function(selectedCertificate, condition)
'Ultimo accesso: ' + function(selectedCertificate, condition) +
' ' +
' ').insertAfter(tr);
}).on('sortStart', function () {
var rows = $(this).find('.row-drop');
if (rows.length > 0) {
// Un-style previous rows
rows.prev().children().removeClass('anthracite-gradient glossy');
// Remove rows
rows.remove();
}
});
script> And then C# code behind:
protected string function(string certificate, int condition)
{
if (condition == 0)
return "data1";
else
return "data2";
}How can i call function passin javascript variable and condition value without refreshing page? The return is a string when searching into sql server db with linq. Thanks very much, any help are apreciated!!

Jaganathan BantheswaranPosted Dec 13, 2013, 7:53 AM
You have to use WebMethod attribute on the head of the C# function.
Read these articles,