.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WCF Data service out put not return correctly

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net


I am consuming wcf Data service in client application following way, when i execute SP, some of the columns are repeating with same value,

  DataServiceContext context1 = new DataServiceContext(new Uri(serviceURL));
  string strparam = "emailid='" + paramemail + "'& LocalTitle='" + paramtitle + "'& ColorGrouping='" + paramcolor + "'";
  string url = serviceURL + "GetSearchResult?" + strparam;
  IEnumerable<Cognos_MTSR> SearchResult = context1.Execute<Cognos_MTSR>(new Uri(url));
  Binding with grid here grid source =SearchResult;

In service part i have written as follows

public List<Cognos_MTSR> GetSearchResult(string emailid, string LocalTitle, string ColorGrouping)

   Entities db = new Entities();
   var query = db.SearchResult(emailid, LocalTitle, ColorGrouping);
   List<Cognos_MTSR> caseList = query.ToList<Cognos_MTSR>();
   return caseList;


can any one suggest on this?


View Complete Post

More Related Resource Links

IE 8 partially cut of my JSON data return from WCF service

Hi All, I am not so sure here is the right place to post my issue. I am using ExtJS treepanel and ajax call to wcf webservice and return JSON array. My service return array. If array count is less than 2, then IE partially cut of my JSON data return from WCF service. But FireFox is working fine with same JSON format string. Very interesting thing is that I try to debug with Fildder. so I have to put "." dot in my url "http://localhost{.}:1234/ then It is working fine.   I am testing with IE8. Here is the JSON format return from FF and FireBug. {"result":[{"href":"..\/EMP\/EmployeeSearch.aspx","iconCls":"","id":"8c362443-7bb3-427e-910c-87b391c6abf5","leaf":true,"text":"Employees"}]} Here is the corrupted JSON string retrun from IE using developer tool. {"result":[{"href":"..\/EMP\/E" [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "GetSiteMap", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] [return: MessageParameter(Name = "result")] List<TreeView> GetSiteMap(string node);

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

Posting data to ASMX and return Object for jQuery


I am using fluent NHibernate with WebForms and I am trying to build a page where I allow a user to post a status update on their profile page and I a using a .asmx WebService to post the data to the database and then returnig a StatusUpdate instance to the page to be used by jQuery. I have a couple problems.

1) First off when I return a string from the WebService(i was testing) the textbox where the user enters their status doesnt empty the contents. And since the page doesnt refresh even if I manally clear out the textbox and put in something else, it still posts the previous status to the database again. How do I fix this?

2) Secondly, when I return the StatusUpdate Object from the Webservice I cant the results to display anything. Like I sad, Im using jQuery to make an AJX call to the WebService.

Here is my code:

User Profile Page:

Status: <asp:Label ID="status" runat="server"></asp:Label><span style="font-size:.7em;"><asp:Label ID="statustime" runat="server"></asp:Label></span><br />
<textarea id="statusBox" rows="3" cols="40"></textarea><br />
<input type="button" value="Update Status" onclick="SetStatus(); return false;

WCF Data Service to JSON example? v4


I would like to take WCF Data Service and produce JSON output to consume on various mobile apps.

Can anyone give me a how-to on the JSON part?  I.e., what is different than normal XML outut?



Data Points: Service-Driven Apps With Silverlight 2 And WCF


Here John Papa demonstrates how to build a Silverlight 2 user interface that communicates through WCF to interact with business entities and a database.

John Papa

MSDN Magazine September 2008

Linq join fields for return data


  how would I join fields together?

           return (from c in storedb.Product_Categories

                         where c.Category_Name.Contains(searchText)
                         orderby c.Category_Name
                         select new {
                                    c.Category_Key && " ;" && c.Category_Name // HOW CAN I DO THIS.....

[newbie] How to return a data record from a webservice (wsdl)?



vs2010, .NET 4.0

I have a webmethod which I want to return a data record (for example: name, surename, address, age, zip etc)

I wonder how to accomplish this. I think the solution is about creating an object which contains all the records serialized. And then the webmethod returns this serialized object. I'm not 100% sure how to accomplish this, if some of you good provide me with some tips, tutorial or link to an article explaining it, that would be great

Binding xml data (which is return from Url) to gridview


I have used Yahoo BOSS API for internal search. This API return string and i want to bind it with gridview. How can i achieve this following is the code

string AppId = "sRP_q9bV34HI_zNyuahPFBGnf1SHyBaIKCtvEjB89EuiNJI6fcfSwAFbwAFSsCV_";
//string Query = "site:way2k.com engineering colleges in pune";
string Query = "colleges in pune"; int NumResults = 10;
     int NumResults = 10;
System.Net.WebClient webClient = new System.Net.WebClient(); request = string.Format( "http://boss.yahooapis.com/ysearch/web/v1/{1}?appid={0}&format=xml&results={2}", AppId, Query, NumResults); byte[] response = webClient.DownloadData(request); string responseXML = System.Text.UTF8Encoding.UTF8.GetString(response); return responseXML;

this code returns result in xml format, how can i bind this XML to gridview so that it looks like search result

SELECT statement to return NULL by matching data from another table.

Hi,I am fairly new at SQL and I have been struggling for days now trying to find an answer to my problem and i have come to the point where i have run out of ideas and about to give up. I'm hoping someone can put me in the correct path. The problem I have 3 table Table 1 Department" has the following columns: REF, NAME Table 2  "Department_Collection" has the following columns: REF, DEPARTMENT_REF, MANAGER_REF, STORE_REF, ACTIVE Table 3 Store" has the following columns: REF, NAME, STORE_ID  What i am trying to do is to take all the rows in the Department table and get a matching row (DEPARTMENT.NAME, DEPARTMENT_COLLECTION.REF) from the Department_Collection table, if it does not match any then still display DEPARTMENT.NAME but mark DEPARTMENT_COLLECTION.REF as null. I have tried the following select statement but it seem to remove all null values when supplied with a 'storename' SELECT DEPARTMENT.NAME, DEPARTMENT_COLLECTION.REF FROM DEPARTMENT_COLLECTION right outer join DEPARTMENT on DEPARTMENT_COLLECTION.DEPARTMENT_REF = DEPARTMENT.REF left outer join STORE on DEPARTMENT_COLLECTION.STORE_REF = STORE.REF where STORE.NAME = 'storename' order by DEPARTMENT.NAME   Any help will be greatly appreciated. Thanks

MERGE using jQuery with a WCF Data Service

I'm a bit new to the whole asp.net thing so this is probably a silly question, but here it goes: I have created a WCF Data service based based on a ADO.net Entity--it's very basic: namespace raid{ public class allPeopleDataService : DataService< raid.raidEntities > { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } }} I've been successfully retrieving data using jquery's '$.getJSON' and inserting data using a modified $.ajax: $.ajax({url: "/allPeopleDataService.svc/lists",dataType: 'json',contentType: 'application/json',data: $jsonObj,processData: false,type: 'POST'}); I was reading the post at http://msdn.microsoft.com/en-us/library/cc668771.aspx and trying to use the MERGE method to update parts of the data with the following jquery jsont = { "__metadata": { "uri": "/allPeopleDataService.svc/lists(1)", "type":"raidModel.list" }, "list_name": "list blah blah" }; $.ajax({ url: "/allPeopleDataService.svc/lists(1)", dataType: 'json',

All data in class properties disappear across WCF service

Hi, I have a class that i share betwee silverlight client and wcf service. I populate properties of the class with real data from the client, to be used in the server. I use debugger to step through the code when the call gets to the server, all the data ara gone and are replaced with null. All DateTime value change to 1/1/1001. But if pass primitive types such as int, string, no problem. This is happening only on one machine, but not on ther machine. Can someone tell me what is going on here? Thanks in advance

Customizing pages with Asp.Net Dynamic Data Domain Service Web Applications?

Hola, It used to be so easy creating new folder under CustomPages with the (Entity/Table name) and copying on it all base default PageTemplates (Details, Insert, Edit, List and ListDetails) and you will get access to those pages only for the specific table (this was the default automatic behavior of the Dynamic Data framework) When it comes to be using Asp.Net Dynamic Data Domain Service Web Applications it seems that we need to learn a new way of doing this because it is just simply different and you got a lot of errors when compiling your application if you do this the old way? What might be the new way, uh? HOW DO WE DO THIS NOW ... I MEAN ... CREATING DEFAULT CUSTOM PAGES FOR SPECIFIC TABLES (Details, Insert, Edit, List and ListDetails) with Asp.Net Dynamic Data Domain Service Web Applications? The problem arises when the definition for your newly created classes is absent from the automatically generated code when you created your domain service !!!!! . If you simply copy the PageTemplates as they are, you got a duplicated error message because the new .designer file (automatically generated) conains the definition of the class you are copying (not the newer one) so even if you rename your .aspx file the result is not what you would normally expect (the .designer class is not regenerated after renaming). The .designer file keeps the domain service definition and if y

Service Operation - Get proper data when browsing the service, but not when calling the service from

Hello, I recently implemented a service operation in an attempt to pass some filter parameters to a data service (a user guid and an organization, actually, for impersonation of a user on the service's call to the application). I successfully added the service operation to the data service, and I can browse the service and see the data filtered as I expected. However, when I call the service operation from the Silverlight client, I don't get any results, even though I should. Am I missing something? Code below if it's helpful. Thanks! Service Operation Definition: [WebGet] public IEnumerable<opportunity> filteredopps(string userid, string org) { /*Define the connection with the impersonated user*/ CrmConnection crmc = CrmConnection.Parse("Authentication Type=Passport; Server=https://" + org + ".crm.dynamics.com/" + org + "; User ID=myuser; Password=mypassword; Device ID=mydeviceid; Device Password=mydevicepassword"); crmc.ImpersonatedUser = new Guid(userid); var crmOnline = new DataContext(crmc); List<opportunity> uplist = new List<opportunity>(); crmOnline.UsingService(service => { var query = from o in crmOnline.opportunityopportunities select o; foreach (opportunity thisopp in query) { uplist.Add(thisopp);

Documentation on impersonation of Windows LiveID with data service?

Hi There, I'm not finding any documentation on impersonating a Windows LiveID over a WCF data service. I can find documentation on Windows Auth. For example, this article is great, but its first step is "Configure Your Service to Use Windows Authentication": http://geekswithblogs.net/manesh/archive/2009/04/23/setting-up-wcf-to-impersonate-client-credentials.aspx. I'm not sure how to do this when I'm working with the LIVEID. Alternatively, and even preferably, if there's a way I can manipulate the connection string the data service is using from the WCF endpoint, that would be ideal. I need to grab some info about the user in the Silverlight app that's using the data service, and somehow impersonate that user. The user is a Windows LiveID, which is what I have hard-coded in my connection string in my web.config. Thanks!  Web: http://invoc.net

User Profiles Service Application and Import of SharePoint 2007 SSP data

I have setup a test SharePoint 2010 Farm. I will be using this as a test upgrade of a current live SharePoint 2007 Farm. The database attach method will be used. I have replicated the web application and AAM settings of the SharePoint 2007 Farm to the SharePoint 2010 Farm and have made the 2010 Farm a DC in a new Forest. I don't want to join this to the current domain at the moment. It also has SQL server 2005 with SP3 and cumulative update 3 installed. I have just setup the User Profiles Serice Application and when I go to Manage it, I get this. Error An unexpected error has occurred.   Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: a1760e87-372f-4711-afac-3ceba34bc599 Date and Time: 8/31/2010 4:22:56 PM I have verified and configured the following. Created the Managed Metadata Service. The status is started via Service Applications and Services on Server. Created the User Profiles Service Application and ensured status is started via Service Applications. I started the User Profile Service and User Profile Synchronisation Service via Manage Services on Server.      

How to query for id's of the fields with List Data Retrival Services Query() web service

Since i marked a post as answer in my previous topic, it seems that people dont visit the topic anymore as they see it as "answered" while it actually is only partially answered. So i guess i have to ask again in a different topic.    I need to get data from Sharepoint Server (3.0 i belive) for my Integration Services project. For that i use Sharepoint's webservices. I've read tutorials and downloaded sample programs to talk to WSS web services. I realise i have two ways to get items in a list: Use Query() or GetListItems(). Problem is, GetListItems() has a mandatory "Row limit" field and i might have to import ALOT of fields, so i thought Query() is better for me.  But, when using GetListItems(), the WSS returns the ID of the fields (for example, for a field of type user, something like "395;Ivanov Ivan Ivanovich" is returned) but when using Query() for the same list, WSS returns only the field value ("Ivanov Ivan Ivanovich") without the ID. I need it to return the ID as well. How can i set it up, on my side or server side, so i would receive the ID's, not only the values of the fields that are actually linking to something by ID when i use Query() web service?     

Not able to read Config File data in Windows Service

While I'm trying to read connection string which is in App.Config file I'm getting error like "Object reference not set to an instance of an object." string strconn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString(); For the windows service where I need to keep app.config file and how to integrate that config file with the windows service exe file. Thanks in advance.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend