Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Passing parameters from frontend using webservice

$
0
0

Hi,

    I have a java script file where we are getting selected Id's and these id's I want to pass to web service method where we are calling stored procedure (Sql server) these id's values should go as parameter to stored procedure and retrieve the data from procedure and bind in the drop down list.

Here is the code

Java script file
 
      var params = [];
        params.push(CreateNewParameter("IdList", GetConcatenateIdsToDownload(selectedId)))
        var dsConfig = GetDataSource(StudentSvcUrl + "GetStudentParameter", params);

Interface

Interface

        [OperationContract(Name = "GetStudentParameter")]         [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]          StdGenericList<StdDropdownListItem> GetStudentParameter(Dictionary<int, string> selectedId);

Svc Method


public StdGenericList<StdDropdownListItem> GetStudentParameter(Dictionary<string, string> selectedId)
{

What ever Id's we are selected that is coming from JS file, The issue is with svc method - I am not able to get it in dictionary (selectedId) it is showing as NULL when I debug it.


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>