问题描述
我正面临着一个奇怪的问题。
我在谷歌中通过各种可能的方式但到目前为止没有运气。如果我错过了某些东西,可以帮助我吗?
我在我的代码中做了一些评论,下面是我正在查看的内容。简而言之,我只需要一种方法将我的提示文本传递给我的按钮单击控制器删除方法中存储在变量'delreason'中的CONTROLLER DELETE METHOD,这肯定会转到控制器删除方法吗?
我的代码:
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");
//When delete button is clicked i need to first gather the reason and pass to controller delete method i.e I ADOPTED QUERY STRING WAY as BELOW YOU CAN FIND sDeleteURL used like query string so i can pass my Row-id asusual and additinally i can pass my prompt text entered .
$(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;
//oTable.fnFilter($(this).val());
$.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, // query string way via URL .
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');
});
});
//我在控制器删除方法中获取行ID但我无法在控制器中获取提示文本我试图访问的地方如
var ReasonForDeletion = Request.QueryString [start];
我错过了什么吗?任何更好的选择是赞赏?
我发现了一些解决方法,但遗憾的是它重定向到其他问题:如果我想在我的控制器上获取PROMPT文本我想重新启动我的** oTable.makeEditable( {** CONTENT ..好吧,但尝试这个只是我无法进一步移动选择并删除删除firstRow后的任何行..
任何杀手方式通过我使用查询字符串提示文本或我的控制器所感知的任何内容我点击后删除方法。
关注
//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
推荐答案
这篇关于如何在按钮单击时将可变数据传递给控制器?数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!