OK... I'm stuck here. Sort of new to C# and consuming web services. I have successfully populated a DropDownList from a SOAP service, but what I really need is to filter that list based on a specific category.
Here's what I have so far:
problemReporting.soapClient s = new problemReporting.soapClient();
problemReporting.NullRequest nr = new NullRequest();
problemReporting.ProblemDescription[] getDescList = s.getProblemDescriptionList(nr);
ddlProblem.DataSource = getDescList;
ddlProblem.DataTextField = "description";
ddlProblem.DataValueField = "code";
ddlProblem.DataBind();
problemReporting.ProblemDescription contains "category", "description" and "code". How do I set the DataSource to equal getDescList where category = Category1? (There's 4 categories of items. The category will be set by a user selecting a category from the previous page, and that value being pulled from the URL via HttpUtility.UrlDecode.)
Thank you in advance for your assistance.
Try this, you could filter after the call with
Linq
, but I recommend you change your web service to take a param to filter the results:Is there a reason why you do not do this on your SQL (if you are using SQL at all). If you can't I would suggest that you take a look at LinQ2Entities. Good luck!