1 person following this project (follow)

Project Description
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 via client code.

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>


The basic template driver came from this article: http://msdn.microsoft.com/en-us/magazine/cc546561.aspx

Last edited Aug 27 2009 at 12:07 AM by Jeff_ATGi, version 3