AJAX :: Returning DataSet / Datatable From Webmethod To Javascript

Sep 16, 2010

I have a simple web method written in the code-behind (not a separate asmx) of a test aspx page.

All it does is return a DataTable(or DataSet) both are failing, gives a blank 500 error saying "There was an error processing the request"

If I switch the return variable type to String, it works fine

I think my issue has to do with the version of the System.Web.Extensions, is that the assembly that actually contains the JSON communication implementation?

I've read all kinds of tutorials about how it should be possible to return the DataTable to javascript and then read the properties with javascript syntax.

For some reason it isn't working for me.

My web extensions is imported through my web.config with the following version

<add
assembly="System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

View 5 Replies


Similar Messages:

AJAX :: ASPX WebMethod Not Running The WebService Webmethod Returning The Page?

May 19, 2010

I have a service that works great on my development box. It uses JQuery to hit my web service, and then the JSON results are sent back.

The web service is located on our basePage.cs. We didn't want to put out an external WebService for this. Our on beta box something different is happening.

The web page seems to be trying to call the web method correctly - the JSON data is being sent... but the server doesn't seem to know it's a webmethod. here's my service function (it's in our basepage.cs which inherits from Page).

[Code]....

View 2 Replies

Dataset Vs. Returning A Datatable

Aug 15, 2010

I have created alot of stored procedures in my application that return the result of a query in a datatable object. I never use a dataset. Why would I ever use a dataset over simply returning the result of a query as a datatable object?

View 3 Replies

Data Controls :: Pass DataTable Or Dataset As Parameter To WebMethod Of WebService

Mar 16, 2014

can datatable pass to web service as input parameter? i have a scenario to pass values as datatable to web service. eg as follows

when Invoice or Bill is entered, I want to send the entered data as datatable to web service to insert into another application.

View 1 Replies

Returning Multiple Tables To Dataset / How To Join/add Two Datatable

Jan 21, 2011

I need to return datatable to dataset in asp.net application. I have a method which has a return value as datatable.


However I need to send 2-3 datatable instead of one. I dont know how to join/add two datatable and what could be the return type?

View 2 Replies

DataSource Controls :: Use DataTable Instead Of DataSet / Returning One Table?

Apr 9, 2010

I'm returning one table. My understanding is that a DataSet can be made of more than one DataTable. I also understand that I can use either of these to return my one table.

Is it better to use the DataTable when I have one table to return instead of a DataSet? Is there any advantage of not using the DataSet in a situation like this? Is there a disadvantage to using the DataSet when only one table is being returned? Does this even matter?

View 6 Replies

Jquery - WebMethod Returning JSON But The Response Obj In $.ajax() Callback Is Only A String

Mar 8, 2011

public class JsonBuilder
{
private StringBuilder json;
public JsonBuilder()
{
json = new StringBuilder();
}
public JsonBuilder AddObjectType(string className)
{
json.Append(""" + className + "": {");
return this;
}
public JsonBuilder Add(string key, string val)
{
json.AppendFormat(""{0}":"{1}",", key, val);
return this;
}
public JsonBuilder Add(string key, int val)
{
json.AppendFormat(""{0}":{1},", key, val);
return this;
}
public string Serialize()
{
return json.ToString().TrimEnd(new char[] { ',' }) + "}";
}
}

Here is the Web Method [WebMethod]

public static string GetPersonInfo(string pFirstName, string pLastName)
{
var json = new JsonBuilder().AddObjectType("Person");
json.Add("FirstName", "Psuedo" + pFirstName).Add("LastName", "Tally-" + pLastName);
json.Add("Address", "5035 Macleay Rd SE").Add("City", "Salem");
json.Add("State", "Oregon").Add("ZipCode", "97317").Add("Age", 99);
return json.Serialize();
}................

View 1 Replies

AJAX :: Web Service Returning A DataTable?

Feb 15, 2010

I am using ASP.NET AJAX 3.5

I have a web service that is invoked by the ScriptManager that is attempting to return a DataTable to the receiving javascript.

[Code]....

[Code]....

My service method is called successfully.

[Code]....

[Code]....

View 3 Replies

C# - Returning Multiple Values To Be Used In JQuery From A WebMethod

Mar 3, 2011

I have jquery using ajax/json to grab an elements ID and then hits:

[System.Web.Services.WebMethod]
public static string EditPage(string nodeID)
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(Global.conString))
using (SqlCommand cmd = new SqlCommand("contentPageGetDetail", con))
{
cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = Global.SafeSqlLiteral(nodeID, 1);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(dt);
}
}
if (dt.Count > 0)
{
string pageTitle = dt.Rows[0]["Title"].toString();
string contentID = dt.Rows[0]["ContentID"].toString();
return pageTitle, contentID, nodeID;
}
else
{
return "Failed";
}
}

When it's time to return I want to grab all content returned from the stored procedure back to the jquery method in the success section and set a hiddenfield, dropdown value, and a title in a textfield. In the jQuery I tried using "pageTitle" but it came up undefined. What do I need to do jQuery side to grab whats being returned and populate fields in my Web Form before showing the form?

View 3 Replies

Javascript Calls To An Ajax WebMethod. How To Get Multiple Output Params Returned

Apr 24, 2010

I know how to call a simple old fashion asmx webservice webthod that returns a single value as a function return result. But what if I want to return multiple output params? My current approach is to separate the params by a dividing character and parse them on teh client. Is there a better way.

Here's how I return a single function result. How do I return multiple output values?

<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
[code]....

View 2 Replies

JQuery :: Returning A Json String From A Webmethod From An Aspx Page?

Nov 27, 2010

My Problem is that i am returning a json string from a webmethod from an aspx page.

I want to create a dynamic html table using that json string but found no solution for that.

Can anyone Provide me the solution to generate html table from json string ?

View 6 Replies

How To Copy Data From Datatable To Dataset.datatable

Oct 31, 2010

how to copy data from datatable to table in dataset i ry this but its readonly property

ds.datatable1=newdt.copy

View 1 Replies

Populate JQuery DataTable With WebMethod Returned Value

Mar 12, 2015

Code:
[ScriptService]
public partial class Default2 : System.Web.UI.Page
{
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string GetStudent()

[code]....

And this is my HTML.What I'm trying to do is populate the JQuery DataTable using the returned JSON Formated data of the WebMethod. But its not working,

View 2 Replies

AJAX :: Microsoftajax.js Libraries To Make My Webservice Calls Via Javascript - Services Returning Basic Types

Mar 9, 2010

I'm working with the MicrosoftAjax.js libraries to make my webservice calls via javascript, right now all my services are returning basic types, like string, int, bool. can i also have my services return things like DataSets, DataTables, or custom Classes that I have built to my javascript side?

View 3 Replies

How To Export A Dataset To Excel And Raise A File Download Dialog From Webmethod

Aug 6, 2010

I am using the following code to export a datset to excel sheet.

[Code]....

Problem is that its not raising file download and hence no export is taking place.The same code works fine in a normal method.But with the webmethod its not working.

View 3 Replies

AJAX :: Send A Dataset From Javascript To Server?

Oct 19, 2010

I tried of creating a new object in javascript.

var ds= Ajax.Web.DataSet();

In project references i had added the Ajaxpro2.dll .

Do i need to install any custom libraries from javascript.

View 2 Replies

WCF / ASMX :: Alternatives To Returning A DataTable From WCF

Dec 7, 2010

I have read a lot of posts describing why it isn't good practice to return heavy objects like DataTable/DataSet to the client from WCF. However, there doesn't seem to be much discussion about the alternatives (or maybe I'm not looking in the right forums).

My problem is this: I've tried to convert my DataReader/DataTable into a List<List<string>>, where List<string> represents the data in each row, but get an error at the point when the data is being sent to the client. A simple List<T> or a one-dimensional array gets returned without any problems. But whenever I try to return a collection of collections, there seems to be an issue. I don't know until runtime what my DataReader would look like as different stored procs are called based on user selection from a web form.

What am I missing here. Is WCF not able to handle collection of collections (I know that multi-dimensional arrays are not supported)?

View 1 Replies

Returning A Single Row In A Strongly Typed DataSet In C#?

Jun 27, 2010

I have a Strongly typed Dataset TableAdapter in C#, how do I get a single row from it?

View 4 Replies

WCF / ASMX :: Returning A DataTable As List In WCF With WsHttpBinding

Oct 19, 2010

Would it be better in terms of payload, if I return a datatable as a List<DataRow> from a WCF method? I have WsHtppBinding for my WCF. I am expecting the datatable to contain 5,000 to 10,000 records.

Also, how can I test the difference in payload sizes when returning a DataTable Vs List<DataRow>?

View 2 Replies

DataSource Controls :: Returning Multiple Tables Into A DataSet

Apr 10, 2010

How to return multiple tables to dataset. My code is

string q = "select job_title,primary_skill,description from T12_Company_AddRequirement where job_code='JB1';select count(p_status) from T12_SentDetails where job_code='JB1'and p_status='Technical 1';select count(p_status) from T12_SentDetails where job_code='JB1'and
p_status='Technical 2';select count(p_status) from T12_SentDetails where job_code='JB1'and p_status='Technical 3';select count(p_status) from T12_SentDetails where job_code='JB1'and p_status='HR'";
SqlConnection con=new SqlConnection(s);
SqlDataAdapter da = new SqlDataAdapter(q, con);
DataSet ds = new DataSet();
da.Fill(ds);
Grid_description.DataSource = ds.Tables[0];
Grid_description.DataSource = ds.Tables[1];
Grid_description.DataSource = ds.Tables[2];
Grid_description.DataSource = ds.Tables[3];
Grid_description.DataSource = ds.Tables[4];
Grid_description.DataBind();

This code is returning error.

View 9 Replies

Data Controls :: Bind DropDownList Using JavaScript / AJAX And DataTable

Aug 28, 2013

I will get required data from the web method that returns as table!!!

[System.Web.Services.WebMethod]
public static DataTable call(String code)
{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();

[Code] .....

View 1 Replies

Returning Single - Row Queries Using DataAdapter - DataTable And DataRow

Feb 10, 2011

I'm fairly new to ASP.NET and am working through a tutorial that demonstrates the use of DataAdapter, DataTable, and DataRow classes. The tutorial focuses on binding returned DataTables to GridView objects - I'm having trouble understanding what to do to extract one row for display. I've found I can do the following:

ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
Northwind.ProductsTable productsTable = productsAdapter.GetSingleByProductID(searchID)
Northwind.ProductsRow productRow = (Northwind.ProductsRow)productsTable.Rows[0];

A ProductsTable should be able to return its own ProductRows w/o resorting to a cast, no? Can't find how to do it otherwise. I'm thinking how to go about creating a form where the user will only ever be working on one record at a time. Wouldn't it make sense for the DAL to return a ProductsRow instead of a ProductsTable?

View 1 Replies

Forms Data Controls :: How To Use A DropDownList With A DataSource Returning A Datatable

Jun 10, 2010

I am trying to use a datasource with a dropdownlist. Eventually, my data source method to call a stored procedure and load the datatable is returns, but for now, I am just creating the datatable manually. I need each item to have two attributes, the text, whixh the user will see in the DDL, and the value that the program will retrieve from and store back to the file.

It is partly working in that the DDL has 3 items, however the text for each item reads "System.Data.DataRowView"

I have to be close, but I can't figure out what I am doing wrong.

[Code]....

View 8 Replies

C# - Use Dataset Or Datatable?

Dec 17, 2010

If I need to fetch one whole column from Table1 in the DB, should I fetch it using datatable or dataset? I can do both ways. I mean ok I should use Datatable. Why is that? What would happen if I use Dataset? ok that's what I wanted to know. So there's memory issue. I mean whatever I use be it Datatable or Dataset, both will be fetching only ONE column frommy table in DB. How is Dateset's gonna use more memory then?

View 3 Replies

ADO.NET :: Number Of Datatable In One Dataset Can Contain?

Aug 6, 2010

i have one question for my project. i am fetching all users data in one dataset, but each user will be in unique datatable to avoid no. of database connection i will fetch data in one single transaction no. of user are more than 10000 ..is it practical to store more than 10000 tables in one single dataset what will be then performance issue for the same, it will be the diffrent application for my project to generate this much of data. how many no. of table one dataset can contain in visual studio 2008 with 3.5 framework?

View 2 Replies







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