I am facing a weird issue .
I gone through every possible way in google but no luck so far.possible help me if i am missing something ?
I done some comment stuff in my code below what i am looking exactly . To be short I just need a way to pass my prompt text which is stored in a Variable 'delreason' to CONTROLLER DELETE METHOD on my button click which is surely go to controller Delete method ?
My Code :
delreason = '';
$(document).ready(function () {
var reason = $("#DropDown_Select").val()
var oTable;
$('#btnDeleteRow').click(function () {
delreason = prompt("r u serious");
$(this).prop('disabled', true);
});
$('#myDataTable').dataTable().fnDestroy();
oTable = $('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth": true,
"bDestroy": true,
"sAjaxSource": "AjaxHandler",
"fnServerData": function (sSource, aoData, fnCallback) {
$('#DropDown_Select').change(function () {
alert($(this).val());
reason = $(this).val()
debugger;
$.ajax({
"type": "GET",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource + "/" + reason,
"data": aoData,
"success": function (data) {
fnCallback(data);
}
});
});
$.ajax({
"type": "GET",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource + "/" + reason,
"data": aoData,
"success": function (data) {
fnCallback(data);
}
});
},
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"sName": "Lead_Id"
,
"bVisible": false,
"bSearchable": false,
"bSortable": false
},
{
"sName": "LeadName"
,
"fnRender": function (oObj) {
return '<a href=\"LeadIndividualDetail/' + oObj.aData[0] + '\">' + oObj.aData[1] + '</a>';
}
},
{ "sName": "ContactName", "sClass": "hidden-xs" },
{ "sName": "CompanyName" },
{ "sName": "Product" }
]
});
oTable.makeEditable({
"sDeleteURL": "/Lead/DeleteData/?start=" + delreason,
sDeleteHttpMethod: "GET",
"event": "click",
"style": "inherit",
"width": ($('myDataTable').width() - 40) + "px",
"height": ($('myDataTable').height() + 20) + "px",
"aoColumns":
[
null,
null,
null,
null
]
});
$("#myDataTable tbody tr").on('click', function (event) {
debugger;
alert("now");
$("#myDataTable tbody tr").removeClass('row_selected');
$(this).addClass('row_selected');
});
});
//I am getting row id at controller delete method but i am unable to get the prompt text in my controller where i tried to access like
var ReasonForDeletion = Request.QueryString["start"];
Am I missing something ? any better alternative is appreciated ?
I found some workaround but sadly its redirecting to other issue : If i want to get the PROMPT text at my controller i want to RELOAD MY **oTable.makeEditable({** CONTENT .. well but trying this simply i can't further move to select and delete any row after deleting firstRow ..
Any killer way to pass my prompt text using query string or whatever is appreciated to my controller Deletemethod on my click .
Regards