Skip to content

Instantly share code, notes, and snippets.

@mlehman
Created April 22, 2010 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlehman/375944 to your computer and use it in GitHub Desktop.
Save mlehman/375944 to your computer and use it in GitHub Desktop.
Fluent.LogicTemplates Example
<%@ Register TagPrefix="fluent" Namespace="Fluent.LogicTemplates" Assembly="Fluent.LogicTemplates" %>
<html>
<head>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
if(!IsPostBack){
BindDataList();
}
}
private void BindDataList() {
...
}
</script>
</head>
<body>
<form runat="server">
<asp:DataList Runat="server" ID="DataListProducts" ItemStyle-CssClass="listing" CellSpacing="4">
<ItemTemplate>
<h2><%# DataBinder.Eval(Container.DataItem,"name") %></h2>
<p><%# DataBinder.Eval(Container.DataItem,"description") %></p>
Quantity: <%# DataBinder.Eval(Container.DataItem,"quantity") %><br />
<Fluent:Choose Runat="server">
<Fluent:When Runat="server" Test='<%# (int)DataBinder.Eval(Container.DataItem,"quantity") == 0 %>' >
Sold Out!<br />
</Fluent:When>
<Fluent:When Runat="server" Test='<%# (int)DataBinder.Eval(Container.DataItem,"quantity") < 10 %>' >
Hurry, supplies are limited!<br />
</Fluent:When>
<Fluent:Otherwise Runat="server">
Order now!<br />
</Fluent:Otherwise>
</Fluent:Choose>
</ItemTemplate>
</asp:DataList>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment