Wednesday, December 24, 2008

ASP.NET Ajax : Templating

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="CSAstoria.index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <style type="text/css">
            display: none;

    <script type="text/javascript" language="javascript">
        var ds;
        var array;
        function pageLoad() {
            ds = new Sys.Data.AdoNetServiceProxy("Northwind.svc");
            ds.query("Products", cbSuccess, cbFailure, null, null);

        function cbSuccess(result, context, opertation) {
            var dataView = new Sys.UI.DataView(document.getElementById("listTemplate"));

        function cbFailure(error, context, operation) {

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:ScriptReference Path="~/MicrosoftAjaxAdoNet.js" />
            <asp:ScriptReference Path="~/MicrosoftAjaxTemplates.js" />
    <div id="listTemplate" class="sys-template">
            <li>{{ ProductID }} - {{ ProductName }} </li>

ADO Data Services : Service Operations and Interceptors

ADO Data Services (aka Astoria) is a very powerful framework, which enables to expose easyly data and methods on the web.
Here is a document which illustrate how to create new methods or intercept calling methods.