in

Hydrus Software Forums

Discussions about Hydrus Software Products

Client-side templated data-bound asp.net AJAX script control

Downloads: 110 File Size: 13.7kB
Posted By: Hydrus Support Views: 213
Date Added: 08-19-2008

Allows a developer to add a repeater-style templated list control to a web page that will be data bound client-side, and may respond to client events. The control may be data bound by a web service call on initialization, and may also have it's data source set and be data bound independently.

The control also supports data-binding and data-bound events during template binding with the .net IDataItemContainer passed in event args.

A simple implementation might look like this:

<script language="ecmascript" type="text/ecmascript">

function MyFunction(sender,EventArgs)

{

if(EventArgs.Item().get_dataItem().FirstName == 'Adam')EventArgs.Item().set_template(EventArgs.Item().get_template().replace('<td>','<td style="background-color:red">'));

}

</script>

<HydrusClient:ClientRepeater runat="server" ID="CustomerList" ServiceMethod="GetCustomers"

ServicePath="Service.svc" DataBindingFunctionName="MyFunction">

<HeaderTemplate>

<table>

<thead>

<tr>

<td>

<asp:Label runat="server">Full Name</asp:Label>

</td>

<td>

<asp:Label runat="server">Role</asp:Label>

</td>

</tr>

</thead>

<tbody>

</HeaderTemplate>

<ItemTemplate>

<tr>

<td>

<HydrusClient:ClientBoundDataProperty runat="server" PropertyName="FullName" />

</td>

<td>

<HydrusClient:ClientBoundDataProperty runat="server" PropertyName="Role" />

</td>

</tr>

</ItemTemplate>

<FooterTemplate>

</tbody>

</table>

</FooterTemplate>

</HydrusClient:ClientRepeater>

Comments

No comments exist for this file.

Add Comment

(required) 
(required)
(optional)
(required) 
Add
Copyright Hydrus Software, 2007. All rights reserved.