ASP.NET Podcast Show #53 - Atlas ListView and some Declarative Databinding
Subscribe – Be like Wally (ok, maybe thats not the best idea)
ASP.NET Podcast site: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2006/05/22/319.aspx
Show Notes:
- Doug Reilly.
- Todd Miranda.
- Dell goes to AMD!
- Source:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DeclarativeDatabinding.aspx.cs" Inherits="Databinding_Databinding" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Declarative Databinding Page</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager runat="server" ID="ScriptManager1" >
<Services>
<atlas:ServiceReference GenerateProxy=true Path="WebServiceProjects.asmx" />
</Services>
</atlas:ScriptManager>
<input type="button" id="btnGetData" value="Get Project List" onclick="GetData()" />
<script language="javascript">
function GetData()
{
WebServiceProjects.GetProjects(OnServiceComplete);
}
function OnServiceComplete(result)
{
debug.dump(result, "Returned data.");
var projectName = $("ProjectResults");
projectName.control.set_data(result);
}
</script>
<div id="ProjectResults">
</div>
<div id="ProjectTemplate">
This is a list of all project in the table tblProject:<br />
<div id="ProjectItemTemplate">
Project: <strong><span id="ProjectNameLabel"></span></strong>
</div>
</div>
</form>
<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<listView id="ProjectResults"
itemTemplateParentElementId="ProjectTemplate" >
<layoutTemplate>
<template layoutElement="ProjectTemplate" />
</layoutTemplate>
<itemTemplate>
<template layoutElement="ProjectItemTemplate">
<label id="ProjectNameLabel">
<bindings>
<binding dataPath="ProjectName" property="text" />
</bindings>
</label>
</template>
</itemTemplate>
</listView>
</components>
</page>
</script>
</body>
</html>