好的,至少有一种方法可以做到这一点。
假设使用名为 YController 的控制器编辑 X:
JavaScript: var MyControllerUrlSettings = { MyControllerPrepareModifyXInfoUrl: '@Url.Action("PrepareModifyAssetInfo", "Y", new { x_txt = " param " })' }
然后有一个 JavaScript 来处理下拉更改:
$('#ModelXList').change(function () {
//// alert('Change detected');
if ($("#ModelXList").val() != "") {
//// alert('Reached here');
var XNbrString = $("#ModelXList").val();
var trimmedXNbrString = $.trim(XNbrString);
//// debugger;
if (trimmedXNbrString != "") {
var url = MyControllerUrlSettings.MyControllerPrepareXInfoUrl;
window.location.href = url.replace('__param__', trimmedXNbrString);
}
}
else {
}
});
最后,在控制器中,有一个方法:
public ActionResult PrepareModifyXInfo(string XNbr_txt)
{
// we cannot save anything here to cdll_cdcloanerlist;
// static variables must be used instead.
/// .... do what you have to do....
return RedirectToAction("ModifyEdit", new { XNbr_txt = XNbr_txt });
}
注意:出于专有原因,我更改了一些语法,以便一切都通用,因此,您可能需要稍微使用上面的代码,但它可以工作
也非常欢迎替代答案!