MVC :: Json Parsing Does Not Work?

Mar 22, 2010

I am working with Yahoo map in asp.net MVC .I want to show pushpin and load map with latitude and longitude saves in database.I am using following jQuery script

<script
type="text/javascript">
$(document).ready(

[code]...

View 3 Replies


Similar Messages:

C# - Script Service For Parsing Json Data Fetched From The URL?

Aug 24, 2010

Does the script service means creating a webservice in asp.net?

View 1 Replies

Parsing Facebook Open Graph Api Json Response In C#

Jul 14, 2010

I try to get parse JSON response for the following link:
https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token=

The response is like that:
{
"135395949809348": {
"data": [
{
....Some data
}]
}
,
"325475509465": {
"data": [
{
....Some data......
}]
}
}

I use System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(string json) method.
But the objects key names always different , so I can't define the class that can be used for parsing this response.Is anyone has any experience in parsing multiple id's response from Facebook?

View 2 Replies

Configuration :: Json Does Not Work On IIS 6?

Sep 14, 2010

I have developed a module to pass Json abjects to the webmethod and return a Json response. The following is the javascript

var options = {

View 3 Replies

Json - JqGrid Doesn't Work In MVC2?

Apr 11, 2010

I have a project in ASP.NET MVC1 using VB.NET controlers and JqGrid. it works fine under MVC1. After migrating the project to ASP.NET MVC2, the grid is no longer populated. It seems that there is some new restrictions on returned Jsonresult in MVC2. How to solve this in VB.NET. Controler function populating the jqgrid is something like this :

Function GetGridRecordset(ByVal qry As String) As JsonResult
Dim result = New JsonResult()
...
...
Return result
End Function

View 3 Replies

Javascript - How To Make Json Child Nodes (JSON Inside JSON)

Aug 11, 2010

I try to use the jquery + json to get all elements in form and build a JSON var to post in a ASP.NET MVC method.

[Code]....

It method get all fields in a form and build a JSON, but it dont put JSON inside JSON.

Example:

If i have the follow form:

<input name="person.name"><input name="person.age"><input name="person.address.street">

The serialized string build a JSON like this

{ "person.name": "??", "person.age": "??", "person.address.street": "??" }

I need a plugin or some function to generate like this:

{ "person": { "name" : "??", "age" : "??", "address":{ "street": "??" } } }

View 1 Replies

AJAX :: Unable To Make Wcf JSON Ajax Service Work Through Http Like Asmx?

Jun 22, 2010

I am new to WCF, I was using web service asmx before. I have trouble on making my wcf JSON ajax service work through http like asmx.Could you help me see what wrong in my code?My WCF services are defined in my website application folder. My aim is to call this service in my aspx page java-script code and return complex object back as JSON to my javascript. I have no problem on doing this through classic asmx web service.


When I try to test it through my browser by type this in the URL , URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc/GetAll. it return "Method not allowed."

But if I type just this URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc, it return this:

WCFCompanyService Service

You have created a service.To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:

C#

class Test { static void Main() { HelloClient client = new HelloClient();

[Code]....

This is my Ajax-enabled WCF service code:

[Code]....

This is the web.config service model setting

[Code]....

View 1 Replies

Read An External JSON File Using Json.NET On Page Load?

Dec 29, 2010

I have a text file named gisQuery129.json that is created using Json.NET - [URL] There is an example on how to create a JSON file and I have done that successfully, but I want to read the file on a page load event and add the values to .NET textbox controls for input values in a query. The created file looks like the following:

{
"myData": {
"randomNumber": "129",
"Application": "MyMapApp",
"FeatureId": "ALL",
"Feature": "ALL",
"spatialQuery": "FEATURE_ID= '11111' AND REQ_SEQ_NUM= 1 AND RAND_PARAM= 129 OR FEATURE_ID= '22222' AND REQ_SEQ_NUM= 2 AND RAND_PARAM= 129"
}
}

I want to read the data in the above sample JSON data and then populate my textboxes something like this:

txtRandParam.text = "129"
txtApplication.text = "MyMapApp" and three more text boxes after that.

View 4 Replies

Json Value Undefined When Converting Datatable Into Json Format?

Feb 1, 2010

I want to retreive the data from database and assign it to dropdownlist. For that I'm using the following jquery in the onclick event

[Code]....

View 1 Replies

How To Convert JSON String To JSON Object Using JavaScript

Jan 21, 2011

I use the JavaScriptSerializer class of ASP.net to serialize my object and return it to the client side. How can I deserialize the string using JavaScript?

View 4 Replies

C# - Converting Json String Into Json On Client Side?

Apr 4, 2011

In my javascript code I am getting json string from cs file

var tmpString="<%=resultset2%>";

In cs I am concatenating strings to build json string. Here is an issue the json string is returned as a string and it has " with it.

"[{id:'1',name:'Aik'},{id:'2',name:'Aik or Aik'}]"

Because of " in beginning and end javascript code treat it as a string.

View 2 Replies

Implementing JSON Feed On Web Application With JSON.NET?

Nov 18, 2010

I've been tasked with implementing a JSON feed on an asp.net website that will be consumed by 3rd party apps (such as IPhone, Android, etc) and I'd like to follow best practices.

An example of what I'd like to achieve would be something similar to: [URL]

I've chosen the JSON.net api as this seems to be highly recommended.

My Google-fu must be failing me as I can't find a single full example code for an Asp.net web application with JSON.net implemented on it, so I've no real concept of where to begin.

My question is fairly simple:

Should I create this sort of feed as an ASPX, or ASHX file? Or even a .NET Web Service? (Remember that the tools that will be using this feed are on external apps like IPhones, etc)

I created a test feed in both ASHX and ASPX format ... here is the code (I'm using Subsonic to populate the collection) ... are either of these along the correct lines?

ASPX:

[Code]...

View 2 Replies

Parsing Url From Xml File?

Aug 18, 2010

I have a xml file having the tags like

<link>
<linkto>[URL]/broadcasts/index.cfm?fuseaction=usrbrd&broadcasterid=57468</linkto>
<image>report_button</image>
<alt>Report a Problem</alt>
<target></target>
</link>
<linkto> tag have the url. But because of the "&" symbol in the url thats completely crashing the page. I tried using like amp; next to the & symbol but this doesn't give the correct url.

View 3 Replies

XML Parsing Error: Not Well-formed - How To Fix It

Feb 1, 2010

I am in trouble. I have a asp.net file and publish it and run in localhost. [URL]. Its working fine.

But i put the file in mob server(It's the own server we are using in my concern)[URL] its not working. I got an error message that is

XML Parsing Error: not well-formed
Location: file://///Mob/mdirectalpha/CPWebserviceAlpha/Addons.asmx
Line Number 1, Column 2:<%@ WebService Language="C#" CodeBehind="~/App_Code/Addons.cs" Class="Addons" %>
-^

Is it the problem in server? I need to set any settings in server?

View 4 Replies

C# - Encoding While Parsing XML File

Dec 11, 2010

I'm developing a small ASP.NET Mvc project in Mono 2.4, Ubuntu 10.10. There is an array of objects, each one of them corresponds to a certain xml file. Reading of the xmls is performed with XmlTextReader. That does not work because xml files have rare "cp866nav" encoding, which is not supported by XmlTextReader ("System.ArgumentException: Encoding name 'cp866nav' not supported"). But it works fine if encoding in xml header is changed to "cp866". I found a kind of solution which consists in initializing XmlTextReader with a StreamReader with a certain encoding instead of file name, like in the code below:

XmlTextReader reader = new XmlTextReader(new StreamReader(Server.MapPath(filename), Encoding.GetEncoding("cp866")));


The issue is that the directory which contains xml files is read only (I can not change it), so I get "System.UnauthorizedAccessException: Access to the path '' is denied.". Rather strange, because XmlTextReader initialized with a filename seems to read the files. Is there any solution, considering that program cannot modify or create files?

View 1 Replies

Parsing Label From One Page To Another

Jan 1, 2011

I'm working on two pages using VB. The 1st page have a textbox to key in the names. And the 2nd page will have a label to display the text thats entered in the previous page.

View 3 Replies

MVC :: Parsing The Model In The View?

Dec 28, 2010

I have a ViewModel class: "MainPage" which contains 2 properties: Title, Id.I have a controller which prepares a list of MainPage and sends it to the view:

public ActionResult SideMenu()
{
MainPageDal dal = new MainPageDal();
DataTable dt = new DataTable();
dt = dal.GetArticlesList();
List<MainPage> mainPageList = new List<MainPage>();
MainPage mainPage;
foreach (DataRow row in dt.Rows)
{
mainPage = new MainPage(Convert.ToInt16(row["Id"]), row["Title"].ToString());
mainPageList.Add(mainPage);
}
return View(mainPageList);
}

In my view I do:
<% foreach (var mainPage in Model) { %>

Now I added "List<String> myList=new..." into my MainPage class and tried to do foreach like this:

Why I can't do: <% foreach (var str in Model.myList) { %>

myList is a list of string inside MainPage.The error I get is:

c:devMvcTestMvcTestViewsHomeSideMenu.aspx(12): error CS1061: 'System.Collections.Generic.IEnumerable<MvcTest.ViewModels.MainPage>' does not contain a definition for 'myList' and no extension method 'myList' accepting a first argument of type 'System.Collections.Generic.IEnumerable<MvcTest.ViewModels.MainPage>'
could be found (are you missing a using directive or an assembly reference?)

View 2 Replies

ADO.NET :: Unexpected End Of File While Parsing Name Occurred

Nov 3, 2010

I am reading XML file in the following code

[Code]....

when my xml file is big, I get the following error unexpected end of file while parsing name has occurred. Line 1, position 2034 the xmlData debug showed that not all the xml file is being read

[Code]....

I read that the memory of the string variable is not big enough to handle the xml file, what can I use to be able to read big xml files. my program works for small xml text.

View 1 Replies

XML Parsing Error - No Element Found

Apr 13, 2010

I am building a website and recently I had to format my re-install everything on my lappy..before that the site was working very good locally..but after re-installing VS2008 I don't know why I keep getting this error

XML Parsing Error: no element found
Location: [URL]
Line Number 1, Column 1:

I searched online..and found out that the reason might be some unclosed HTML tag but I checked and made sure that all the tags are properly closed..I also added Response.ContentType = "text/HTML"into .cs files in Pge_Load method..but I am still getting that error..I have one master page and two pages rendered using it..I dont understand how come the same program works once and after re-installing VS it doesn't work I dont know if this will help or not but master page starts with these 3 lines

[Code]....

View 7 Replies

Parsing A String To Determine It's A Website URL?

Oct 26, 2010

In ASP.net what's the best way I can parse a string to determine if it's a valid URL?

View 2 Replies

Parsing Simple Xml With Jquery From Webservice?

Nov 8, 2010

I'm breaking my head over this for a while now and I have no clue what I do wrong. The scenario is as followed, I'm using swfupload to upload files with a progressbar via a webservice. the webservice needs to return the name of the generated thumbnail. This all goes well and though i prefer to get the returned data in json (might change it later in the swfupload js files) the default xml data is fine too.

So when an upload completes the webservice returns the following xml as expected (note I removed the namespace in webservice):

<?xml version="1.0" encoding="utf-8"?>
<string>myfile.jpg</string>

Now I want to parse this result with jquery and thought the following would do it:

var xml = response;
alert($(xml).find("string").text());

But I cannot get the string value. I've tried lots of combinations (.html(), .innerhtml(), response.find("string").text() but nothing seems to work. This is my first time trying to parse xml via jquery so maybe I'm doing something fundemantally wrong. The 'response' is populated with the xml.

View 2 Replies

Parsing A String For Special Characters In C#?

Mar 6, 2011

I am getting a string in the following format in the query string:

"Arnstung%20Chew(20)"

I want to convert it to just "Arnstung Chew". How do I do it?

Also how do I make sure that the user is not passing a script or anything harmful in the query string?

View 2 Replies

VB - Simple Directory Path Parsing

Jan 21, 2010

i have a asp.net web application and i need to take a full Directory path (for ex: http:\<server><websitename>folder1 est.lst) and parse the name of the folder that has test.lst file. The directory tree can vary and i just need a generic way to parse this path and find the directory name which has the file.

View 2 Replies

Stuck On ASP / WCF WSDL Parsing Error

Apr 6, 2010

I have a WCF Web Service that my ASP.NET app uses. It has been working fine for quite some time. I just added in a Dev Express Grid (and the Dev Express DLLs) and a new page that uses them and now I am getting parsing errors on the WSDL. But the weird part is that it works fine on my machine but fails on the web server machine. (Both are connecting to the same web services WSDL.) Here is the error message I am getting:

Server Error in '/MyWebAppWebDev' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Reference.svcmap: Failed to generate code for the service reference 'MyWebAppService'.

Cannot import wsdl:portType

Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter

Error: Referenced type 'WebClientApp.MyWebAppService.ReferenceUpdatesDataContract, WebClientApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contract name 'ReferenceUpdatesDataContract' in namespace '[URL] cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:portType[@name='IMyWebAppReferenceDataServiceLib']
Cannot import wsdl:binding

Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:portType[@name='IMyWebAppReferenceDataServiceLib']
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:binding[@name='MyWebAppServicesDefaultEndpoint']
Cannot import wsdl:port

Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='[URL]wsdl:binding[@name='MyWebAppServicesDefaultEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:service[@name='MyWebAppReferenceDataServiceLib']/wsdl:port[@name='MyWebAppServicesDefaultEndpoint']

Source Error:

[No relevant source lines]

Source File: /MyWebAppWebDev/App_WebReferences/MyWebAppService/ Line: 1

I am completely stumped on this. I have checked my web.config endpoint address and it is spot on (and notably is not in the error message above).

Things I have tried:

Giving permissions to C:Windows emp to my Website user name
Giving permissions to C:Windows emp to my App pool user name
Checking to see that none of my data contracts are generic and have IsReference=true in them.

View 1 Replies

Javascript -.Net RegularExpression Validator Parsing Bug?

Jan 24, 2010

I wanted to write a regular expression using the ASP.Net RegExp validator that would ensure a field contains only numeric and decimal values, and at least one character.

^[0-9]{1,40}(.[0-9]{1,2})?$

Essentially: [0-9]{1,40} - meaning at least one to 40 numeric characters.The ASP.Net regexp validator does not fire for an empty field - where there is not at least one character.

[code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved