<script>
// 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 class="row-drop">' +
'<td colspan="' + tr.children().length + '">' +
'<div class="float-right">' +
'<button type="submit" class="button glossy mid-margin-right">' +
'<span class="button-icon"><span class="icon-mail"></span></span>' +
'Send mail' +
'</button>' +
'<button type="submit" class="button glossy">' +
'<span class="button-icon red-gradient"><span class="icon-cross"></span></span>' +
'Remove' +
'</button>' +
'</div>' +
'<strong>Certificate Number: </strong>' + selectedCertificate + '<br>' +
'<strong>Area: </strong> ' + +' <br>' + function(selectedCertificate, condition)
'<strong>Email: </strong><br>' + function(selectedCertificate, condition)
'<strong>Ultimo accesso: </strong>' + function(selectedCertificate, condition) +
'</td>' +
'</tr>').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!!