.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

Webservice Return as List Need Help to set result as List

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

Hi all,

I have webservice which return list of class.

    public List<Myclass> MyMethod(String ID)


//some operetions is done


I am calling this service and I want to get result as list.

its accessable myclass (public) ad myMethod Public

I tried

List<myservice.Myclass> myserv=new List<myservice.Myclass>();

I want to result to bing on above variable.

myservice.NewWebServiceService newme = new dene.NewWebServiceService();


I gives an error such as

Error    1    Cannot implicitly convert type 'WindowsApplication1.myservice.Myclass[]' to 'System.Collections.Generic.List<WindowsApplication1.myservice.Myclass>'    C:\Documents and Settings\Mikail\Belgelerim\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs    24    20    WindowsApplication1

Thanks for any reply.

View Complete Post

More Related Resource Links

How to return back to a specific page in a gridview list?

Hello,  I have a gridview with paging. So for instance, I'm on say the page number 10, and I open the form details on a specific record_id (link). After I update/submit the form, it returns to page number 10. But, if I go to another page, for instance page 5, and submit the form, it returns to page 10. I've tried some things, for instance history.back(), but it returns to the first page I went to, in this case page number 10 (or whatever the first page I go to). Hopefully this code helps to understand what I'm asking: <asp:GridView DataKeyNames="Referral ID" ID="gvList" runat="server" CellPadding="4"     ForeColor="#333333" GridLines="None" OnRowCommand="gvList_RowCommand"     OnRowDataBound="gvList_RowDataBound" OnRowDeleted="gvList_RowDeleted"     OnRowDeleting="gvList_RowDeleting" AllowPaging="True" PageSize="20"     AutoGenerateColumns="False" OnPageIndexChanging="gvList_PageIndexChanging"    OnRowCreated="OnRowCreated" AllowSorting="True" OnSorting="OnSort"> protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)        {   &nb

Navigate through a generic list using a webservice

Hi I have a problem where I would have a dataset coming to me and I would break into 5 new generic LIST<>. Now the user needs to see one record at a time and navigate through the list Fields like               From date : Text box with calendar                To Date : Text box with calendar               Manager Reporting To : Drop down list                Buttons on Move Back  and move Forward Now I would have 4 such similar lists which I have to pick up from the audit table. When the user clicks on move back and move forward buttons he should be able to navigate through records in my list that I have fetched in the beginning . I can store it in a session or viewstate till it gets updated again. How do I achieve this. Can I also a gridview instead of textboxes. What should be the simplest way to achieve this. Thanks!      

Display the list column values along with the search result

Hi All, i created custom Scope (to search on specific list) and i need to display all list columns on my search results.  Say i have 2 columns in the list and i have created a scope to search in only in that list. If i do a search in tat scope i would like to get the list values which fits in the search along with the columns as well. thanks jayaraja

wcf returning a list from wcf service - I have lots of locations and I want to return the locations


How is it possible to return some kind of list from a wcf serivce, this the method in my wcf service 
my interface:

    [WebInvoke(Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "Locations")]
    IList<Location> GetLocations();

 public IList<Location> GetLocations()
        Pazar.Data.Repositories.LocationRepository locRepository = new Pazar.Data.Repositories.LocationRepository();
        return locRepository.GetRootLocations().ToList<Location>();

and this how my GetRootLocations looks like, It returns IQueryable, I wounder if I can maybee return Iqueryable from my svc-service?

public IQueryable<Location> GetRootLocations()
        IQueryable<Location> locations = GetAll().Where(p => !p.ID_Parent.HasValue).OrderBy(p => p.Sequence);
        return locations;

using share point list webservice




HI all,

i am new to sharepoint development. i'm currently try to access the sharepoint server my local machine and having access only to a inner document library.i need to get all data inside that document library. i'm trying to use list.asmx service to retrive all items inside that document library.

but i'm getting error ''401 Unauthorized".

my sharepoint url is like http://mysite.com/Sites/MainCollection/abc/asd

i'm having acces only to asd document library.i need all items (folders and files) inside this document library.

service i'm using is http://mysite.com/_vti_bin/Lists.asmx.

i'm able to add the service to my local project and view all the methods inside the list service but getting error when try to access it.

could someone help me please.




ListData.svc fails if list has calculated column with Yes/No (boolean) return type


I have a list with a calculated column whose return type is Yes/No.  If I try to browse to the list or a list item using REST via ListData.svc, I get the error "An error occurred while processing this request".  Can't seem to find anything in 14\LOGS or the System or Application event logs.  I've tried multiple calculation formulas such as:



Both display "Yes" when viewing through the SharePoint UI and are sortable and filterable.  If I change the calculated column return type to anything else (single line of text, currency, date/time, etc.) and update the formula as necessary, ListData.svc displays the list item XML as expected.  If I replace the calculated column with a regular column whose type is Yes/No, ListData.svc displays the list item XML as expected.

Is this a known bug?  Is there a workaround (other than manually casting to bool in my code)?

Creating new List Item with Lookup, Owner and DateTime fields WebService



I've created a function that creates a List Item, given a bunch of values (Using the WebService). This works fine when I try to populate plain text fiels. But in the list item there are a few picklists and an owner field. When I try to populate these, I get no error but the new record is not created:

      //batch.SetAttribute("OnError", "Continue");
      batch.SetAttribute("ListVersion", "1");
      batch.SetAttribute("ViewName", "");

      batch.InnerXml =
        "<Method ID='1' Cmd='New'>" +
        " <Field Name='ID'>New</Field>" +
        " <Field Name='Title'>" + title + "</Field>" +
        " <Field Name='Owner'>" + owner + "</Field>" +
        " <Field Name='Status'

Content Query result without link to source list

I've added a content query webpart to a page to show a multiple line text field from a list item. That works fine but the content is shown as hyperlink and if I click the content, the source item of the list is shown. I wanted to use the content query only to show the filtered content, without having the possibility to open the related item. Is that possible or is the content query webpart the wrong way to show content from different sources (lists) only as text in a page?

.net 2010 REST WCF - json does not return the root List type



I am using the .net 2010 WCF Rest Service Application template to create my services.

The service needs to support two return format - xml and json which 2010 easily handles by changing the Accept value in the header info.

I have the following class structure

   public class ri
        public string nm { get; set; }

        public string nval { get; set; }

        public string cnt { get; set; }

    public class r
        public string val { get; set; }

        public string nm { get; set; }

        public List<ri> ri { get; set; }

   public class refinements
        public List<r> refs { get; set; }

   public class GetRefinementsSvc
        [WebGet(UriTemplate = "")]
        public refinements GetCollection

Confusion about web service return types (classes, generic list)?


I have confusion about web service return types? Can a webservice return a genelist? ex: List(Of Employees)

I have searched threads in this forums but got confused, some say 'yes' some say 'no'.

If I mark the class as Serizable will that be enough to return a generic list?


Generic list with WebService throws 'Two Mappings for []' exception


Please consider below libraries:

ClassLibrary.dll (Smart Device Class Library project)

 public class B
        public string test;

 public class C
        public List<B> tempList = new List<B>();

WebServie (.NET 2.0)

Contains reference of ClassLibrary.dll
public class Service1 : System.Web.Services.WebService

        public List<B> ListOfB( string str)
            B obj = new B();           
            obj.test = str;

            List<B> list = new List<B>();

show search result as default parameters when initiation of business data list



I want to show search result as default parameters when initiation of business data list.

Is there any solution to solve this problem. Thanks.

How to return a generic list in json format


Hi how would i go about returning a generic list in json format, can anyone point me to any good examples. Thanks

flatten a result set to a list

I have a table full of contact data coming from an ibm database where the designer didn't believe in relational data. I'm manipulating this data into my sql 2008 system. So my staging data looks something like this

fname   lname  clientid  code
John    Doe           1  NP
John    Doe           1  EB
John    Doe           1  CL
Jane    Smith         2  NP
Jane    Smith         2  FN
Joe     Blow          3  EB
Joe     Blow          3  CL

I want to return this data like this...

fname   lname  clientid  code
John    Doe           1      NP,EB,CL
Jane    Smith         2      NP,FN
Joe     Blow     

Webservice versions.asmx: Getversions-method returns error on an item of a custom list.


I using GetVersions from the webservice http://server/_vti_bin/versions.asmx. This method works Okay in SharePoint 2007, and in SharePoint 2010 it also works Okay on documents from a document library. But when I used on an item from a custom list, it returns an error stating: "Value cannot be null.\r\nParameter name: key". In SharePoint 2007 I could retrieve the histroy on an item with the call GetVersions("Lists/MyCustomList/5_.000"), in SharePoint 2010 this fails.

Do I need to change the parameter, or use another filename for an item instead of "5_.000"? Does any one have the same experience?

Thank you

SSIS: return list of custom objects after a Script Task


I'm having problems returning a list of self-created .NET objects to a SSIS object variable.

In my SSIS Script Task I'm calling:

Dim fileList As List(Of FileNameEntityDate) = read.getFileNameEntityDate

Directly after this call, It is populated as the size of the List != 0:


Now, I'm trying to return that list to SSIS using variables:

Dts.Variables("oFilenameEntityDate").Value = fileList

oFilenameEntityDate is defined in SSIS as being an Object.
It is also placed in my 'Script Task' under 'ReadWriteVariables'.

When I watch that variable, it seems empty:

- User::oFilenameEntityDate
	Type	__ComObject	
	Value	System.__ComObject	

What should I do to get this working? Thanks!!

Return list of items to a controller method


I have these tables in my database - Presses, Paper, and PressPaperSpeeds:

PressID (PK)

PaperID (PK)

PressPaperSpeedID (PK)
PressID (FK)
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