Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
       }
Posted
Comments
Karthik_Mahalingam 26-Feb-19 0:42am    
are you getting any error in console window?
sayli1995 26-Feb-19 0:50am    
getting null value but in a table i.e 18 in Table Row where ProdID =5
Karthik_Mahalingam 26-Feb-19 1:38am    
Change your method to this

public JsonResult GetTaxRt( int ProductId)
{
var ttx = dc.Product_master.Where(p => p.ProducID == ProductId).FirstOrDefault();
var PGstRate= ttx.Gst_taxRate;
return Json(PGstRate, JsonRequestBehavior.AllowGet);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900