C# - Script Service For Parsing Json Data Fetched From The URL?
Aug 24, 2010Does the script service means creating a webservice in asp.net?
View 1 RepliesDoes the script service means creating a webservice in asp.net?
View 1 RepliesI 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]...
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?
I'd like to read data server-side from a web service that outputs in json format. I haven't found any good examples that don't use jquery and are server-side.
Specifically I'm looking at the "weight" field from this api:
[URL]
PS: this is a spin off of another post at: [URL]
Just ramping up on JSON and JQuery and returning data to a ASP.NET web page from a web service using Ajax. The JQuery part is pretty straight-forward. However, when trying to return JSON formatted data instead of XML from a 2.0 web service, I'm stuck. The web service does have the System.Web.Script.Services.ScriptService attribute, so I can hit it via JavaScript; however, the web service always...always...returns data in XML format, no matter if I explicitly say I want JSON as the datatype in my JQuery code. So I don't know if this is an issue with the web service or the JQuery code. I posted this here, but realize that the category could be incorrect depending on where the issue is. Is there no way to return JSON data from a 2.0 web service? It's a production web service, so I can't change the code unfortunately.
View 3 RepliesI still can't seem to get this to work.I've tried string arrays object arrays dictionaries. I might be formatting my JSON incorrectly however I am using the labs_JSON plugin. If I remove my data and test the webservice it calls correctly. The : My code looks as follows :
HTML :
<div style="display: block; float: left;">
<asp:Repeater ID="rptMenuRecipeCategories" runat="server">
<HeaderTemplate>
<div class="recipeChecklistHeader">Menu Recipe Categories</div>
[Code]....
I want to make a web servcie(.svc) that returns JSON data after entering the input.....which is resulted as in the downloaded filein JSON format.i want something like that-http://209.62.6.226/GracoRest/service.svc/Rest/WheretoBuyplease help me for the above but....step by step...i m trying WCF very 1st time
View 3 RepliesI have some problem with the Localization in ASP.net. I have generated the resources and binding the text property by an variable. In the source file.
<asp:Label ID="Label1" runat="server" Text='<%# Eval("name") %>' meta:resourcekey="Label1Resource1"></asp:Label>
code behind
protected string name;
protected void Page_Load(object sender, EventArgs e)
{
name = "Hello World";
}
The above things are simple but when I run the project. I got 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: Cannot have more than one binding on property 'Text' on 'System.Web.UI.WebControls.Label'. Ensure that this property is not bound through an implicit expression, for example, using meta:resourcekey. Source Error: The above is just an example what I am facing in my project. how can I make localization and binding both at the same time.
I am using the local database in web kit browsers and to get the data from the database I have the following code:
function synchronise() {
myDB.transaction(
function (transaction) {
transaction.executeSql("SELECT * FROM Patients;", [], synchroniseHandler, errorHandler);
}
);
[Code]....
I uploaded a few new pages to a web site and now I am getting these errors no matter what I try. Parser Error
Description:
An error occurred during the parsing of a resource required to service this request. review the following specific parse error details and modify your source file Parser Error Message: Could not load type 'PSR.MasterPage2'.
Source Error:
[Code]....
Source File: /MasterPage2.master
I Need by service contract to return the xml/json result depending on the request type. function which will convert my result set (i am using linq to sql) so that i do not need to create the xml format for the result set by iterating through the table row many times.What is the suitable way to do that.
I need a kind of short cut method which will convert the table data to xml result.Had i been using asp.net mvc i would have been able to generate the xml data by overriding the the ExecuteResult method in the ActionResult and giving Conetnt-Type = "text/xml" as OP.But since i am using Wcf i don't have the controller context(as controller context is the parameter that needs to be passed to Execute Result).
My present code for converting the table data to the xml format is below.
public XDocument UsersLists(string authToken)
{
bool IsAuthenticated = Authenticate(authToken);
XDocument xDoc = new XDocument();
XElement root = new XElement("Users");
[Code]....
I need to eliminate this way of generating xml for each table records.
I am binding a datalist to some table 0 of a dataset from the database. When I check the number of rows in the dataset table 0 it's coming as 129 but when I check the count of the datalist items(using Datalist_Name.Items.Count) inside the datalist item created event I am getting a maximum count of 128.Due, to this I am unable to assign values to the last label control(last as in the last row) present inside the datalist dynamically. I am not sure where I am going wrong. I even tried to replicate the same code inside the ItemDataBound event but even then I am getting the same error.
View 5 Repliesi want the following in 1 div. say <div="topdiv">: i want to display on aspx page one image and its description fetched from database. i want to provide a next button at the side of it, onclick of this the next image and descriptn must be displayed without page being refreshed. i have another div (<div="divbottom"> which displays other information..
View 1 RepliesParser 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: System.Web.UI.WebControls.RoleGroupCollection must have items of type 'System.Web.UI.WebControls.RoleGroup'. 'ContentTemplate' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'. Source Error:
[Code]....
page.aspx
<asp:LoginView ID="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup ="Administrator">
<ContentTemplate>
<asp:DropDownList ID="NewAssignTL" runat="server" AutoPostBack="True" ToolTip="Select team leader name" />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
We have a web application providing a service using a simple REST interface (GET/POST methods) and returning results in JSON format.
A client wants to use the service from an ASP application (I assume ASP.NET) and asks for example code.
Is there any standard/widely-acceptable procedure for consuming JSON based web services from an ASP.NET application? I'm not familiar with the .NET framework, but can work my way through C#.
I am getting an exception with the JSON Web Service with MVC 2.0.0.0.
Earlier it worked.
The code:
[Code]....
The exception:
[Code]....
What are the pros and cons of the following 2 cases: Case I: Traditional way: Add service reference in project. Create object and Get data from service on server side and bind to asp.net grid. Case II: Update Service for JSON behavior. Add service reference in project. Call service from javascript to get data. Bind data to jquery grid. Which one is the best approach and why?(Not developer point of view)
View 2 RepliesI have developed a wcf service for asp.net ajax client. It includes the following steps.
(1) Created WCF sevice contract with the operation "DoWork()" which will take string as input and retun string as output.
(2)Implemented the above operation contract(attributed the implementation class with aspnetcompatibility requirement as enabled).
(3)Added the webscriptenabled to endpoint in web.config file.
(4)Hosted the wcf servie.
(5)Downloaded the javascript file from the service.(e.g.,http://localhost/service1.svc/js)
Client
(1)Opend new asp.net webapplication.
(2)Added the downloaded .js file.
(3)Given the scripts path for ajaxscript manager as both .js file and service url.
e.g
<asp:ScriptManager
ID="id1"
runat="server">
<Scripts>
<asp:ScriptReference
Path="http://localhost:3443/Service1.svc/js/"
/>
<asp:ScriptReference
Path="~/js1.js"
/>
</Scripts>
</asp:ScriptManager>
(4)With this I am unable to call service method
I just want that when i enter name in Textbox1 it shown in TextBox2 when i click on Button
I am using HTML page here's the code
<input id="txtID" type="text" /><br />
<input id="txtName" type="text" /><br />
<input id="btnShow" type="button" value="Show" />
[Code]....
But when i load this Web Page its show this error after click on button
Error: 12031 unknown
Error: 500 Internet Server Explorer
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": "??" } } }
I have an containing a list of divs that jQuery turns into progress bars. On .ready, I build a list of all of these progress bars and for each one, call a webservice that gets a value indicating how full the progress bar should be. In order to do this, I need to pass the ID of the div to the web service.
Because the divs are inside a ListView, I manually set the id to be id="completionbar_<%# Eval("MilestoneID") %>"
However, when I pass this id into my web service, it comes up as "undefined" every time. When I view the source, it looks like it's set correctly.
Here's the jQuery that calls my web service:
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".MilestoneCompletion").progressbar({ value: 0 });
$.each($(".MilestoneCompletion"), function(index, barDiv) {
[Code].....
I'm thinking maybe the script is executing before the DIV id is set by the ListView databind?
After much head scratching as to why my returned Json string is breaking JSON.parse, I have realized that it is the returned dates that it doesn't like.
.net property:-
[code]....
As I am getting Problem while hosting WCF Service on Win 2003 Server.As it is working fine in my local P
View 1 RepliesAs it is now I create a JavaScript object and then stringify it, put it in a hidden textbox and my code behind can read this string. I then use JSON.NET to parse the string which works fine. I now try to use ajax to post it to my web service but have some issues with how to send the string. I have tried many ways but gets the common errors like
Invalid JSON primitive: myString.
So I checked this out [URL] and it works with hard coded values but I want to use a variable.
JavaScsript to create the object:
for (var i = 0; i < results.rows.length; i++) {
var row = results.rows.item(i);
var customer = new Object();
customer.id = row['id']
customer.name = row['name']
var customerString = JSON.stringify(customer);
$.ajax({
type: "POST",
url: "synchronise.asmx/synchroniseCustomers",
data: "synchroniseCustomers: " + customerString,
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (xhr, status) {
alert("An error occurred: " + status);
},
success: function (msg) {
alert("success");
}
});
}
WebMethod:
public void synchroniseCustomers(string customerString)
{
JObject o = JObject.Parse(customerString);
string id = (string)o["id"];
string name = (string)o["name"];
If I use data: '{ FirstName: "Dave", LastName: "Ward" }'
in the example above it works but I wish to pass on a string instead.
I was told to build a rest web service using asp.net so does the code below represent the same
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
[Code] ......