Returning a DataTable from WebService using Ajax

Hi Everybody,
I need to create a web service that is consumable on the client side.
This web service should return a DataTable which I should consume on the client side.
My question is how can it be done correctly.

Can someone please show me an example of a web service consupmtion  that returns a DataTable, and how to retreive data from that  retruned DataTable on the client side. (using javaScript and the Microsoft Ajax Library).

 Thanks in advance,

                            Mike Smith.

 

 

 

0
mike_smith
7/28/2008 11:45:33 AM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

4 Replies
501 Views

Similar Articles

[PageSpeed] 20

Hi! The best way is to create table as html on server side and return it as string to client side. Then you can put the generated table as innerHTML property of an div or something.
0
morfeus
7/29/2008 8:42:42 AM

 Hi,

Thanks for the reply. Your approach is may be acceptable in some cases.

But do you think thare is a way for returning the DataTable object and accessing it from the client side?

 

 

0
mike_smith
7/29/2008 3:48:47 PM

This might help you: http://forums.asp.net/t/1247105.aspx

But basicly is the same as returning an string for example. How ever, I tested to transfer datatable in .NET 2.0 but it returns error (something like serialization is not supported) but I think that in .NET 3.5 should work.

0
morfeus
7/30/2008 7:29:12 AM

Hi

Since ADO.NET 2.0 DataTable is serializable. Google for "datatable serialize site:microsoft.com" and you will find a lot of stuff on this.

 

0
ashayderov
7/30/2008 9:09:52 AM
Reply:

Similar Artilces:

to use a webservice or not to use a webservice?
hi folks, i have a web-based application that connects to a server for processing and then gets back the data from the server asynchonously to display to the user--specifically, the user identifies a product by answering coupla questions and then the program connects to a CAD server to generate models of the product to display to the user. creating the CAD files typically takes little over a minute or so...but i would like to know whether its a good idea to use a web-service to connect to the CAD server and then do the processing or whether remoting is a better way to do this. ...

call webservice using javascript without using AJAX and webservice.htc?
HI,how can i call a webservice without using AJAX and Webservice.htc, using any protocols?Thanks.X you could skip using an AJAX framework and issue an xmlHttpRequest directlyhttp://en.wikipedia.org/wiki/XMLHttpRequestMike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ Hi, thanks mbanavige.well, is there any disadvantage of using xmlhttprequest?and one more question can AJAX also work on other web servers than IIS like Apache? and is AJAX compatible with all browsers other than IE?how can i call a web servi...

how to retrieve a value which is returned by a webservice method by using the webservice behavior
Hello Mate,                     I am using the webservice behavior to call a webservice method through internet. but i have a problem in getting a value which is returned from a webservice method. the jscript shown below is not working. Could u please help me in this ? This is my web method:<WebMethod(True)> _ Public Function add(ByVal a As Integer, ByVal b As Integer)Return a + b End Function  This is my jscript file: Function add() {  service.useService("GridTasks.a...

how to return datatable in webservice?
 Hi   can someone here knows how to return datatable in a web service?   thanks place it inside a dataset and return the dataset.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ Keep in mind that if you return a .NET-specific type like DataTable, only .NET code will be able to call your service.John Saunders | MVP – Connected System Developer...

Using WebService from Ajax
I need to access WebService from ASP.NET page in AJAX way and I cannot use ASP.NET AJAX(ATLAS) library. I haved added Web Reference to WebService . Now In Button click event, I need to use that WebService from javascript button click event handler. I cannot use ASP.NET AJAX library. Any Help ? Hi, from internet search, http://www.devx.com/enterprise/Article/27882/0/page/1http://uk.builder.com/architecture/web/0,39026570,39273618,00.htm# good example inside articles....

how ro use EAServer webservice in dw.net dev in vb.net?
i use pb10 dev a webservice but use dw.net have any problem such as sybase.datawind.blob, fullstate,changes and so on.how to deserialize Since PB10 is in beta, you need to post such questions in the private beta newsgroup. On 3 Jun 2004 07:21:01 -0700, "ma.frank" <ma.frank@163.com> wrote: >i use pb10 dev a webservice but use dw.net have any problem such as >sybase.datawind.blob, fullstate,changes and so on.how to deserialize > Bruce Armstrong [TeamSybase] http://www.teamsybase.com Two new books on developing with PowerBuilder http://www.pb9books...

Use a webservice to return a webpage
So I wrote some AJAX stuff a while ago using JS that basically would return any given page as html. So i could do something like $get("div1").innerHTML = getPage(menu); and this would aschronously load the menu page into the div. This was great because i could write the menu page using asp. I just started looking at web services and was wondering how I could do the same thing. Basically I want to call the service and have it return a page that I have already create. I am currently just returning the data that fills that page and formatting it all in JS but its a pain.  Thank...

Ajax.NET WebService problem
Hi community,   I am making a site that follows the exact same procedure found at http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2008/05/01/asp-net-podcast-110-integrating-asp-net-ajax-with-google-maps.aspx , and it works fine when I compile and run it under localhost. (The setup is : Master page with a <ScriptManager> which points to a WebService (.asmx) file. Then the main asp.net page (.aspx) has a few javascript functions, which call methods from the .asmx file.)  When I upload to our IIS server, and try view it across the internet, the page loads, but does...

Using .Net Webservice in Win32
Hi, I have a .Net app that has the following Delphi .Net Code. routeService := staging.mappoint.RouteServiceSoap.Create; routeService.Credentials := NetworkCredential.Create(AUserName, APassword); routeService.PreAuthenticate := True; I need to convert this to Win32 for another app I am working on, but am stuck on NetworkCredential. There doesn't seem to be a Win32 equivelant that I can see (maybe I just need to know where to look) How do I get past this as its needed for the authentiation. Do I need to send some SOAP headers? If so what object do I need or how do I...

Webservice returning DataTable to GridView
Hi All, I have a webservice that I have set up, that searches Active Directory, and returns the results as a datatable to a gridview on my aspx page. However when i view the page in my browser, it is coming up blank. Pretty sure it's not permissions related as other parts are working. Not sure where I'm going wrong, and been staring at it for too long now. Here is the code for my 2 functions in the WebService. This function is the datasource for my GridView:  Public Function fillcontactinfo() As DataTable Dim directory As DirectoryEntry = New DirectoryEntry("LDA...

Secure the data in XML (returned by a webservice) during Webservice calls
          My website has a flash object which call a webserviec which returns a xml back to flash.  How can i secure the data which is passed through the XML.  That is I dont want any users read the xml which i am giving to falsh object using any tools like fiddler, fire bug etc... Please give me your valuable suggestions and IdeasRegards    Hi, check this URL regarding secured web service   http://msdn2.microsoft.com/en-us/library/aa302428.aspx...

ModalPopup using WebServices (WebService Call Failed: 500)
Hi All,   I am trying to populate a gridview and display the results in a Modal Popup.  I have wired it all together, but when it calls the webservice, it is not dropping into the web service.  It finds the .asmx file which calls a .cs file and begins to run through the process, but it doesnt run the WebMethod.   Here is all the code, your help is greatly appreciated. The asmx File: <%@ WebService Language="C#" CodeBehind="~/App_Code/ModalSerivice.cs" Class="ModalService" %> Here is the WebService: [WebService(Namespace = "http://tempuri.org/")] [WebService...

Using Ajax with a Webservice .asmx
I have a simple Webservice that java script says is undefined. The webservice and calling page are in the same directory. Other ajax objects see to be fine. Can anyone tell me what is going on? Thanks Lenfunction Button1_onclick() { ret = WSAjaxTransport.HelloWorld(document.getElementById('Text1').value); //ret = WSAjaxTransport.HelloWorld(document.getElementById('Text1').value, OnComplete, OnTimeOut, OnError);return(true); }function OnComplete(arg) { alert(arg); }function OnTimeOut(arg) { alert("TimeOut encountered when calling Say Hello."); }functi...

Not able to use datatable in webservices.
We want to use datatable rather than dataset in webservices, since Datatable is implementing ISerializable interface, We are assuming it should automatically return XML. We have also used RemotingFormat = SerializationFormat.Xml but still in webservices we are receiving error. Do we have to write the xml to a file and stream it back? There will be lot of file IO on each request. In ADO.NET 1.x the datatable class, although it supports object serialization, does not support any form of XML Serialization. Notice that there is no .ReadXML and .WriteXML methods. This will change in ADO....

Web resources about - Returning a DataTable from WebService using Ajax - asp.net.networking-webservices

webservices Articles, Posts, Blogs, Videos - Technorati
— Authority: The job consist in a PHP program that read a file, compose a message (email or sms) and call an API of email provider (Amazon SES) ...

Section: software:webservices
Wired.com © 2012 Condé Nast. All rights reserved. Use of this Site constitutes acceptance of our User Agreement (effective 3/21/12) and Privacy ...

Products - CrunchBase
Product profiles

App Search on Flickr - Application Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Wikipedia:Press coverage 2005 - Wikipedia, the free encyclopedia
If you add an article, please cite both the title and the source. Note that if you're listing an article from a traditional press wire service ...

Entity–relationship model - Wikipedia, the free encyclopedia
In software engineering , an entity-relationship model ( ER model for short) is an abstract and conceptual representation of data . Entity-relationship ...

Entity-relationship model - Wikipedia, the free encyclopedia
In software engineering , an entity-relationship model ( ER model for short) is an abstract and conceptual representation of data . Entity-relationship ...

IT and Telecommunications Jobs in Melbourne Metro - MyCareer
Find IT and Telecommunications Jobs in Melbourne Metro on MyCareer. Fresh IT and Telecommunications Jobs posted daily. Free email alerts and ...

AWS Elastic Beanstalk: A Quick and Simple Way into the Cloud
Flexibility is one of the key principles of Amazon WebServices - developers can select any programming language and software package,any operating ...

How To Use the Amazon SDK for Android to Upload Photos to Amazon S3
This article demonstrates how to use the AWS SDK for Android to upload an image to Amazon Simple Storage Service (S3) from your mobile device ...

Resources last updated: 12/7/2015 2:02:28 PM