Errors in ASP. NET recently written & automatic conversion between datatable and dataset Client/Server

Source: Internet
Author: User

Causesvalidation attribute setting: if it is not set to false, the Ajax callback will not respond, or if it is set to true, it will be submitted to the background for processing even if the input does not meet the requirements (without the submit button)

The client calls WebService, where WebService returns the DataSet object: the error message"Webmethod dataset system. invalidoperationexception: A circular reference was detected......"

Solution:

1. Add [System. Web. Script. Services. scriptmethod], As follows:

1 [System. Web. Script. Services. scriptmethod (responseformat = System. Web. Script. Services. responseformat. XML)]
2 Public Dataset getdata ()
3 {
4 }

However, this method returns XML. After the client calls the WebService method, the content of the XML document is returned.

 

2. in the web. the config file enables ASP. net Ajax futures CTP's self-contained able and dataset-related javascriptconverter components (see: sp. net Ajax asynchronously calls the class methods in Web Services and pages-automatic conversion of data types on the server and client (Continued 4), as follows:

First, make sure that the project references Microsoft. Web. Preview. dll.ProgramSet. (To http://go.microsoft.com/fwlink? Linkid = 77294 download "Microsoft ASP. NET Ajax

After futures CTP is installed, go to the default installation folder (C: "Program Files" Microsoft ASP. net "ASP. NET 2.0 Ajax futures January CTP "v1.0.61025 .) ASP. net Ajax futures CTP: This part is ASP. net
The "non-core" part of the original CTP version that AJAX temporarily "discards" is also called the "value-add" package, which includes the server-side extender control (Extender
Control), Web Components, various client controls, drag-and-drop functions, ASP. NET Ajax
XML scripts. The so-called "abandon" means that Microsoft does not officially support the content for the moment, but chooses to use"CommunitySupported. In this way, Microsoft will not
The content provides detailed development documents. developers can only discuss each other in the community to find a solution to the problem. To install this part, you must first install ASP. NET 2.0 in the "core" section.
Ajax extensions. (See ASP. Net Ajax programming-section 2nd of chapter I of volume I)

After adding a reference, add the following content to the Web. config file:

< System. Web. Extensions >  
< Scripting >  
< WebServices >  
< Jsonserialization >  
< Converters >  
< Add Name = "Datasetconverter" Type = "Microsoft. Web. Preview. Script. serialization. converters. datasetconverter, Microsoft. Web. Preview" />  
< Add Name = "Datarowconverter" Type = "Microsoft. Web. Preview. Script. serialization. converters. datarowconverter, Microsoft. Web. Preview" />  
< Add Name = "Datatableconverter" Type = "Microsoft. Web. Preview. Script. serialization. converters. datatableconverter, Microsoft. Web. Preview" />  
</ Converters >  
</ Jsonserialization >  
</ WebServices >  
</ Scripting >  
</ System. Web. Extensions >

The preceding content is as follows:

< Configsections >
< Sectiongroup Name = "System. Web. Extensions" Type = "System. Web. configuration. systemwebextensionssectiongroup, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" >
< Sectiongroup Name = "Scripting" Type = "System. Web. configuration. scriptingsectiongroup, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" >
< Section Name = "Scriptresourcehandler" Type = "System. Web. configuration. scriptingscriptresourcehandlersection, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" Requirepermission = "False" Allowdefinition = "Machinetoapplication" />
< Sectiongroup Name = "WebServices" Type = "System. Web. configuration. scriptingwebservicessectiongroup, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" >
< Section Name = "Jsonserialization" Type = "System. Web. configuration. scriptingjsonserializationsection, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" Requirepermission = "False" Allowdefinition = "Everywhere"   />
< Section Name = "Profileservice" Type = "System. Web. configuration. scriptingprofileservicesection, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" Requirepermission = "False" Allowdefinition = "Machinetoapplication"   />
< Section Name = "Authenticationservice" Type = "System. Web. configuration. scriptingauthenticationservicesection, system. Web. Extensions, version = 1.0.61025.0, culture = neutral, publickeytoken = 31bf3856ad364e35" Requirepermission = "False" Allowdefinition = "Machinetoapplication"   />
</ Sectiongroup >
</ Sectiongroup >
</ Sectiongroup >
</ Configsections >

 

Everything OK ~ Haha ~

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.