How to use JSON as the preferred data format for invoking Web Services from the client side.

in JavaScript use call like

function OnPageLoad()

NameSpaceName.ClassName.FunctionName(......Arguments......, FunctionNameAfterReturnToBeExecuted);

}

on Service

[WebMethod(EnableSession = true)]

public string FunctionName(..arguments..)

{

Bind Json string with JsonObjectCollection and JsonArrayCollection and return the object as String();

}

 

on JS

function FunctionNameAfterReturnToBeExecuted(result)

{

if(result != null)

{

  var JsonObject = eval('('+ result +')');

  for(var i = 0; i < JsonObject.JSONArrayName.length; i++)

  {

      var JsonItem = JsonObject.JSONArrayName[i];

                    //now use the Item to render page as in Table or in div or whatever ....

  }

}

}

hope this will work.. point me out if m missing something..


Rahul
Web Developer
CoCubes.com
0
themasterpiece83
6/17/2008 6:25:04 AM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

1 Replies
790 Views

Similar Articles

[PageSpeed] 36

I’m not really sure if I get what you are trying to do but ASP.NET Ajax uses JSON already for sending data between the server and the client, you don’t need to do anything, takea look at this link:

http://www.asp.net/ajax/documentation/live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx

look for "Passing and Returning Complex Types"

Hope this helps,

Elias.


If this post helped you please remember to set it as Answer so it can help others.
0
mrmercury
6/17/2008 12:33:45 PM
Reply:

Similar Artilces:

Bind data to the grid at the client side using AJAX call to web service
With the Current AJAX Tool kit is there a way to databound the grid at the client side.  Basically I want to make a WCF web service all and get the JSON message and populate the grid at the cient side. I am using Visual studio 2005 with .NET frame work 3.0. Please point out if tehre are any examples. I truly appreciate any help regarding this. Thanks I hope this article will help you. http://www.aspdotnetcodes.com/Ajax_ModalPopup_PostBack_GridView.aspxMarking a Reply as 'Answered', not only GAIN us some POINTS, but it also HELP others to find RIGHT solution. Thanks for the...

To display data we can use JSON return from WS, but what about edit a list of data and post back, what should be used on client side?
I remember there were a full client side demo back to the ATLAS age, I need edit a list of rows on client side, and post back when all done, What should I do in this case? thanks  Hi, The easiest method is using gridview in updatepanel. Please check out this link for more information: http://www.asp.net/AJAX/Documentation/Live/tutorials/UsingUpdatePanelControls.aspx Best Regards,Sincerely,Jin-Yu YinMicrosoft Online Community Support I use updatepanel in some places. It is good to save data without page post back. But what I need now is a way to do multi ...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

Consuming Web service from .net 3.5 web application using ajax
Hi , Before in .net 2005 ,I use to consume the  web service from client side via Ajax and java script. that's just adding web service inside the script manger services.But  it was not possible with .net 2008 version WEB APPLICATION   , Even it works well with .net 2008 web sites. Please help me to solve the issue. I have no idea what you mean. Please post the code that "does not work". NC...   I have the same problem.  I have a .NET 3.5 Web Application not Web Site.  I fully qualify the web service with the namespace i,e,  &n...

Cannot call a web service from java script using ajax in .net 3.5 web applications
As like 2005 .net websites i tried to consume a web service from client side java script  using Ajax script manager in  .net 3.5 (2008) version web application it was not working, Event it works with 3.5 web sites, What i have to do to solve the issue. Thanks in advance Hi, can you create the least amount of code to reproduce it and post it? This gives us the ability to check out your code and better guide you. Also please check out this article: Create a Simple WCF Web Service and Use In JavaScript With Visual Studio 2008 and .Net 3.5.  Grz, Kris.Read my blog. Handy Fire...

send data from web service to local computer, using web services.
hii have a web application, on web server , and a database on my local computer in my office.i want to send data from my web pages to my local database.i think one way is using web services.i used that, but it has permission errors.that web service have this error :  Server Error in '/in' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30180: Keyword does not name a type.Source Err...

use web service for client side retreival
I have a pretty large windows app written in C#.  I have been given this app and have been asked to create an asp.net front end utilizing web services.  The problem is I do not know where to start.   any info is appreciated...Remember to "Mark As Answer" if this post has helped you! Thanks....And I say unto you, Ask, and it shall be given you; seek, and ye shall find; knock, and it shall be opened unto you...LK 11:9http://adventwebdesign.net Ok, so now I got the web service written to get and set values but now, how do I do the opposite.... How do I send i...

How to use a ColdFusion client to a WSE .NET web service?
How to use a ColdFusion client to a WSE .NET web service? thanks...

How to use a PHP client to a WSE .NET web service?
I'm using username token without encryption WSE 3 features on my web service.  How can a PHP client consume my web service?  Is this a totally unheard of use case?  I can't find anything on it.Andrew L ArnottVisual Studio Platform & Ecosystem Did you ever get an answer to this and if so could you share? Having the same issue I'm afraid I didn't.  I got as far as an unencrypted, username token authentication WSE web service, but I still haven't gotten a PHP client to be able to pass the credentials in as required.You'd think this would be a more popular issue.Andre...

problem in using java web services from .net client
I am trying to make a .net client for a java web service made using JAX-WS 2.0 . Actually the web service maintains session of the client. Well i did create a client from java and it worked. But i am having problem in consuming the web service from .net client. According to the specification of that web service i have to set the SESSION_MAINTAIN_PROPERTY of the BindingProvider true to indicate whether or not the client wants to participate in session with service endpoint. It is done in java client in following way:Hello proxy = new HelloService()...

Using AJAX and client side scripting with .NET objects?
I'm wanting to use client-side scripting and AJAX with some drop down boxes.  I can't seem to do this with server-side .NET objects... changing the runat tag doesn't do anything either.  How can I expose .NET server objects so that they are affected by java script and AJAX? Depends on what, exactly, you're trying to do with them.  If you just need access to the html properties (e.g. selectedValue), then you simply grab them as if they were their html equivilants (select element) in javascript.  If you want to pass custom properties back and forth (or any .Net property ...

web service call failed: 500 using ajax hovermenu and web service with ascx file
I am using a hovermenu extender on an image button. The hovemenu extender calls a web service and returns back information that I write to the panel that displays. A portion of the code is below. This works when the Page is an aspx page but when I move it to an ascx page I get web service call failed. I do have the ascx page in a folder called controls/pages off of the root but both the default.aspx page and the bedinfo.asmx page are on the root. I don't think I have a path problem. I can include more complete code, there are actually 50 images with 50 hovermenu extenders and one p...

Has anyone successfully used a Delphi web service client against an ENCRYPTED WCF web service server?
Has anyone successfully used a Delphi web service client against an ENCRYPTED WCF web service server? Which is to say, of course, that the URL would be starting with https. Anyone? ...

How to write data to a file in client side using javascript or someother client side scripting language.
Hi, I would like to know how to write a data to a client side file using javascript or someother client side scripting language. The file type expected is ini file. txt file would also be appreciable. Thanks in advance.   If the site is a trusted and you are running IE then you could try http://www.w3schools.com/asp/asp_ref_filesystem.asp The Old Sewing FactoryThat twitter nonsense. You can write to the server, but not to the client's machine.  Being able to do so would be a huge security breach.When you ask a question, remember to click "mark as answered"...

Web resources about - How to use JSON as the preferred data format for invoking Web Services from the client side. - asp.net.ajax-discussion

Preferred stock - Wikipedia, the free encyclopedia
Preferred stock , also called preferred shares , preference shares , or simply preferreds , is a special equity security that has properties ...

Facebook Suspends TBG Digital From Preferred Marketing Developer Program
Not long after several companies celebrated their entrance into the Facebook Preferred Marketing Developer Program, one company has lost its ...

Preferred Marketing Developer Program - Facebook-Entwickler
Come check out what we're doing in the Preferred Marketing Developer Program Our Mission:...

Preferred Marketing Developers
Facebook Marketing Partners Overview Program policies Badge requirements Directory Ads API Overview We’re evolving, so you can thrive The ...

Facebook Adds 25 New Preferred Developer Consultants, Improves PDC Lookup Tool
Today Facebook added 25 more developers to the Preferred Developer Consultant Program, bringing the total number of developers in the PDC Directory ...

Back to the ‘80s: The Preferred Social Networks of The Breakfast Club Members
Back to the ‘80s: The Preferred Social Networks of The Breakfast Club Members

Sankaty Advisors named as preferred buyer for GE's commercial assets
Sankaty Advisors has been named as preferred buyer for GE Capital's Australian commercial assets, sources told Street Talk.

iClick Interactive Asia establishes preferred deal for Tencent's Qzone
iClick Interactive Asia establishes preferred deal for Tencent's Qzone Campaign Asia-Pacific iClick Interactive Asia (“iClick”), the integrated ...

Whitney Cummings on codependency: ‘I lost friends who preferred me as a doormat’
... on others’ approval, it’s climbing Mount Everest. Recovery is not without its cataclysmic life changes. I lost some friends who preferred me ...

Bikeshare Hawaii Will Let Public Help Choose Preferred Bikesharing System
Originally published on Gas2. A new bikesharing scheme is giving members of the public in Hawaii the opportunity to choose their preferred technology ...

Resources last updated: 12/11/2015 6:31:25 PM