Skip to content
Loading
  • +1
    ok i have a try as per you said and if any issue came i will post my doubt again
    +1
  • 0
    Hai  Saineshwar Bageri i did the same thing as per you said by keeping one button and get the count details see this below link and tell me the solution for this problem..
     
    http://www.c-sharpcorner.com/forums/how-to-pass-multiple-parameter-using-json-in-mvc4
     
     
    Advance thanks..
    0
  • Saineshwar Bageri
    0
    take you button as
     
    0
  • 0
                          
    Saineshwar i got this error
     
    My j-query code:
     
    $(document).ready(function () {
    $("#Button1").click(function () {
    debugger;
    var cardetails = { customerID: $("#CustomerID").val(), fromdate: $("#fromdate").val(), Todate: $("#Todate").val() };
    $.ajax(
    '@Url.Action("GetSalesOrderCountByCustomer", "Report")',{
    type: "POST",
    data: JSON.stringify(cardetails),
    dataType: "json",
    contentType: "application/json",
    error: function (ex) {
    alert('Failed to retrieve states.' + ex);
    },
    beforeSend: function () {
    },
    success: function (data) {
    $("#count").val(data);
    }
    });
    });
    });
     
    public JsonResult GetSalesOrderCountByCustomer(Guid customerID, DateTime fromdate, DateTime Todate)
    {
    var salescount = (from sc in db.SalesOrders where sc.CustomerID == customerID && sc.CreatedDate == fromdate && sc.CreatedDate == Todate select sc.SalesOrderID).Count();
    return Json(salescount, JsonRequestBehavior.AllowGet);
    }
     
    I cant able to change all the datatype to string. It showing Operator == cannot be applied to operant system. Guid  and Datetime error. 
    0
  • Saineshwar Bageri
    0
    Change it to string
     
    public JsonResult GetSalesOrderCountByCustomer(string customerID, string fromdate, string Todate)
    {
     
    }
     
    After that covert that values in format to use it with Linq 
    0
  • 0
    Saineshwar  i cant able to change the data type to string it showing 
    Operator == cannot be applied to operant system. Guid and Datetime error.
     

         
     
    See the error and im using EF. 
    0
  • Saineshwar Bageri
    0
    You can convert that Value and use with Linq or store parameter in Variable and User
    Int tempcust = Convert.toint32(customerID );
    var salescount = (from sc in db.SalesOrders where sc.CustomerID == tempcust select sc.SalesOrderID).Count();
    return Json(salescount, JsonRequestBehavior.AllowGet);
    0
  • 0
    ok lets i have a try
    0
  • 0
    Saineshwar please help to resolve this issue.  i posted one of my big issue in this link. please help me for this problem
     
    http://www.c-sharpcorner.com/forums/cascading-text-box-not-working-correctly-in-mvc4 
    0