ASP.NET Podcast Show #101 - ASP.NET AJAX Futures Data - Video and Audio - More Wally - Wallace B. McClure
in

MoreWally.com

Giving people what they want, More Wally. This is the technical and personal blog site of
Wallace B. (Wally) McClure.

This Blog

Syndication

News

Please goy buy 3-4 copies of my book on MonoTouch titled "Professional Android Programming with Mono for Android for .NET/C# Developers." They make great gifts all year round. Plus, I get about $.25 when you buy a copy.

Technical Sites

More Wally - Wallace B. McClure

This blog will have all kinds of posts about Wally McClure. In it, there will be tons of .NET and computer programming posts as well as Wally's views on life in general. As you might guess, this site and blog help you get More Wally in your life. What more could anyone want? iPhone, Android, MonoTouch, MonoDroid, Mobile, HTML5, .NET, ADO.NET, ASP.NET, AJAX, jQuery, jQuery Mobile, ASP.NET AJAX, and Windows Azure............follow me on twitter at Wally

ASP.NET Podcast Show #101 - ASP.NET AJAX Futures Data - Video and Audio

Subscribe <-- What everyone should be doing.

Download WMV <-- The old style way of doing it.

Download MP4 for Ipod and Zune <-- ditto

Download MP3 <-- ditto

Original url: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2007/09/21/asp-net-podcast-show-101-asp-net-ajax-futures-data.aspx

Show Notes:

Web.config additions:

<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>

Web Service Code

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Script.Services;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Xml.Linq;

using Microsoft.Web.Preview.Services;

/// <summary>

/// Summary description for WebService

/// </summary>

[WebService(Namespace = "http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

[ScriptService]

public class WebService : DataService

{

public WebService()

{

//Uncomment the following line if using designed components

//InitializeComponent();

}

[
WebMethod]public string HelloWorld()

{

return "Hello World";

}

[WebMethod]

[DataObjectMethod(DataObjectMethodType.Select)]public DataSet GetValues(int i)

{

DataSet ds = new DataSet();

DataTable dt = new DataTable();

DataRow dr;

dt.Columns.Add(new DataColumn("Name"));dt.Columns.Add(new DataColumn("ID", Type.GetType("System.Int32")));

dr = dt.NewRow();

if (i % 2 == 0)

{

dr["Name"] = "Wally McClure";

dr["ID"] = 1;

}

else

{

dr[
"Name"] = "Paul Glavich";dr["ID"] = 2;

}

dt.Rows.Add(dr);

ds.Tables.Add(dt);

return (ds);

}

}

JavaScript code:

function pageLoad() {

WebService.GetValues(1, OnCompletion);

}

function OnCompletion(results)

{

var dataOutput = "";

var divOutput = $get("Output");

var strReturn = "<br />";

dataOutput = "Dataset: " + strReturn;

for(m in results)

{

dataOutput += m + strReturn;

}

dataOutput += "DataTable: " + strReturn;

for(m in results.tables[0])

{

dataOutput += m + strReturn;

}

dataOutput += "Rows: " + strReturn;

for(m in results.tables[0].rows)

{

dataOutput += m + strReturn;

}

dataOutput += "Rows[0]: " + strReturn;

for(m in results.tables[0].rows[0])

{

dataOutput += m + strReturn;

}

dataOutput += "Rows[0].Name: " + strReturn;

for(m in results.tables[0].rows[0].Name)

{

dataOutput += m + strReturn;

}

dataOutput += "Columns: " + strReturn;

for(m in results.tables[0].columns)

{

dataOutput += m + strReturn;

}

dataOutput += "Columns[0]: " + strReturn;

for(m in results.tables[0].columns[0])

{

dataOutput += m + strReturn;

}

dataOutput +=
"rows[0].Name: " + results.tables[0].rows[0].Name + strReturn;

dataOutput += "Columns[0].dataType: " + results.tables[0].columns[0].dataType + strReturn;

dataOutput += "Columns[1].dataType: " + results.tables[0].columns[1].dataType + strReturn;

dataOutput += "Columns[1].isKey: " + results.tables[0].columns[1].isKey + strReturn;

divOutput.innerHTML = dataOutput;

}

ASP.NET AJAX Futures Data

Comments

No Comments
2006 - Wallace B. McClure
Powered by Community Server (Non-Commercial Edition), by Telligent Systems