Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i tried this

In ViewPage:
JavaScript
$.ajax({
          type: "POST",

          url: "http://localhost:63461/api/CarDetails/AccCode, CurrCode, ACBCode , DateFrom , DateTo , DocNo",

});

Controller:
C#
[HttpGet] 

public DataSet GetAllcarDetails(string AccCode, string CurrCode,string ACBCode, string DateFrom, string DateTo, string DocNo) //
{
// Code here...
return ds;
}

WebAPIConfig:
C#
config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }


);
Posted
Comments
Sathish km 25-Nov-15 4:43am    
[HttpGet]
public DataSet GetAllcarDetails(string AccCode, string CurrCode, string ACBCode, string DocNo) //
{

string connString = @"Data Source=db; Initial Catalog=xx; Integrated Security=True;";
LtSqlClient sqlClientConn = new LtSqlClient(connString);

LtSqlParams LtSqlParams = new LtSqlParams();
LtSqlParams.SPName = "SP_Name";

LtSqlParams.addParameter("@intUID", 523); //105086
LtSqlParams.addParameter("@intDTCode", "403");//403 intDTCode
LtSqlParams.addParameter("@intCompanyCode", 1);
LtSqlParams.addParameter("@chrTag", "s"); //ChrTag
LtSqlParams.addParameter("@intCurrencyCode", CurrCode); //172 strCurrencyCode //CurrCode
LtSqlParams.addParameter("@chrACCode", AccCode); //qz000010 strACCcode
LtSqlParams.addParameter("@dtFinancialPeriodFrom", "13 - JUL - 2015"); // "13 - JUL - 2015" DateFrom
LtSqlParams.addParameter("@dtFinancialPeriodTo", "13 - NOV - 2015");// dtVoucherTo DateTo
LtSqlParams.addParameter("@strACBCode ", ACBCode); //008 strACBCode ACBCode
LtSqlParams.addParameter("@strDocumentNo", DocNo);//500100 VoucherNo 0 DocNo
LtSqlParams.addParameter("@chrTLRNumber", "99999");//500100 ChequeNo



DataSet ds = new DataSet();
ds = sqlClientConn.LtDataSet(LtSqlParams);

return ds;
}

How do i assign parameter to this from your link?

1 solution

I hope this will help you pass multiple parameters to Web API method using jQuery Ajax call

http://techbrij.com/pass-parameters-aspdotnet-webapi-jquery[^]
 
Share this answer
 

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