本文介绍了如何通过使用选定的下拉列表值作为参数并从data-table获取值来获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i成功从下拉列表中获取选择值prodID = 5
(表名:Product_master)
然后我需要得到其他相关表格的相关表格(Product_master)
我尝试了什么:
jquery
Hi ,
i successfully get a select value from drop-down list it's prodID = 5
(table name:Product_master)
then i need to get other field which concern form same table (Product_master)
What I have tried:
jquery
$(document).ready(function () {
$("#ProdID").change(function () {
var pID = ($("#ProdID").val());
var url = "/Perchus/GetTaxRt";
$.post(url, { ProductId: pID }, function (data) {
$.each(data, function (Row) {
$("#PGstRate").append("<option value='" + row.ProducID + "'>" + row.Gst_taxRate + "</option>")
});
alert("You May Edit This Tax Rat IF You May It ...")
});
});
});
控制器
controller
[HttpPost]
public JsonResult GetTaxRt(PerchesDetail pd, int ProductId)
{
var ttx = dc.Product_master.Where(p => p.ProducID == ProductId).FirstOrDefault();
pd.PGstRate = ttx.Gst_taxRate;
return Json(pd.PGstRate, JsonRequestBehavior.AllowGet);
}
推荐答案
这篇关于如何通过使用选定的下拉列表值作为参数并从data-table获取值来获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!