Click here to Skip to main content
13,445,555 members (35,081 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi ,

We are migrating the code from .net 2.0 to .net 4.0.During migration we are having a problem at Jquery,ajax and jason function.

In .net 2.0 the code was converting dataset to xml using below code
stream = new MemoryStream();
               writer = new XmlTextWriter(stream, Encoding.Unicode);
               int count = (int)stream.Length;
               byte[] arr = new byte[count];
               stream.Seek(0, SeekOrigin.Begin);
               stream.Read(arr, 0, count);
               UnicodeEncoding utf = new UnicodeEncoding();
               return utf.GetString(arr).Trim();

in jquery it is loading as xml.loadXMl(result).

When I try the same code in .net 4.0
Just adding .d to

alerting the value it is coming as null.
When I hard code that xml xml.loadXMl(hardcoded xml )as it is working fin e.Where as when I print result.d it is coming fine but adding an extra character to xml.

Can any one help how to solve this?
Posted 4-Mar-13 18:35pm
Richard MacCutchan 5-Mar-13 6:06am
You need to show the actual Javascript code where the problem occurs, also make sure that the XML data is correctly formed and accessible to the browser.
Prashant Bangaluru 5-Mar-13 7:01am
I just found the error.When I am converting to XML it is adding a special character in front of XML .Hence the xml is not loading.But I dont know how to remove that..Can you help me now
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Sorry, I don't event want to read your code. Any statements about jQuery working with any versions of .NET not just incorrect, they makes no sense at all and indicate your lack of understanding how Web works in principle.

This is because jQuery is a JavaScript library, and JavasScripts "knows" nothing about .NET, as well as any implementation detail of the server-side in general.

In turn, the source code you show (I still have to look at it) has nothing to do with jQuery. I see no evidence that something is not working. Any functionality can be screwed up if you don't understand the very basics.

What to do? Anyway, not to continue this project. First, try to learn how ASP.NET, HTTP, JavaScrip, jQuery work from first principles. Then come back to the project. Yes, I'm serious.

Prashant Bangaluru 5-Mar-13 1:50am
I dont know JQuery that's why I am suspecting that it is problem with Jquery.Because when I loaded that xml with hardcoded value it is working but when I load the result.d nothing is showing..Its true I should learn the tech.
Great idea. Learn it step by step and come back to the application.
Good luck,
Prashant Bangaluru 5-Mar-13 3:52am
Thank You....
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi ,I solved the above issue..It was because of the above code snippet when forming dataset to xml adding an special character.I rewritten the code without considering encoding.It worked fine.

string result;
> using (StringWriter sw = new StringWriter()) {
> ds.WriteXml(sw);
> result = sw.ToString();
> }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02-2016 | 2.8.180314.2 | Last Updated 6 Mar 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100