We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I add value as a Additional parameter in WebMethodAdaptor?

Thread ID:





143676 Apr 1,2019 04:11 AM UTC Apr 1,2019 12:52 PM UTC Angular - EJ 2 1
Tags: Treeview
Md Jonayed Hossain Chowdhury
Asked On April 1, 2019 04:11 AM UTC

I tried to make a treeview, where the json come from a server using POST operation. In the post method, I need to send value in the body. For this I use WebMethodAdaptor and addParams for add the value. Here is my code:

export class AppComponent implements OnInit {
public hierarchicalData: Object[];
public projectId = 'projectID';
public value = 'C03374EC2';
public field: Object;

public ngOnInit(): void {
new DataManager({
adaptor: new WebMethodAdaptor
}).executeQuery(new Query().addParams(this.projectId, this.value))
.then((e: ReturnOption) => this.hierarchicalData = <Object[]>e.result).catch((e) => true);
this.field = { dataSource: this.hierarchicalData, id: 'zoneID', text: 'zoneName', child: 'subZone' };



Now the problem is the WebMethodAdaptor send data in the following formats,


But I need,

{ "projectID":"C03374EC2" }

Christopher Issac Sunder K [Syncfusion]
Replied On April 1, 2019 12:52 PM UTC

Hi Md Jonayed, 

We have validated your query. Please check whether you have properly initializes the params in the serve side where you fetch the data. 
[Server side code] 
// initializes params at server side. 
public bool requiresCounts { get; set; } 
public int skip { get; set; } 
public int take { get; set; } 
public string data { get; set; } 
public Dictionary<string, object> @params { get; set; } 

While providing the above code snippet you will get the params in the following format. 

This is how the additional parameters get added from the server side request. 

For more information you can check the following documentation link 

Please check whether the provided information fulfills your requirement . If not, please share your code snippet (server side) or sample that replicates your issue if possible. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon