Click to See Complete Forum and Search --> : [RESOLVED] If Style Statement required in Data Repeater..


GremlinSA
June 11th, 2008, 10:34 AM
Okay so i have my data repeater listing a number of items.[

The Repeater is assigned data with DBItemData = DB_Get_by_List(ListID)
MPItem.DataSource = DBItemData
MPItem.DataBind()

Now some of the data in that object must only be displayed on certain conditions...(Well One condition)
<%#DataBinder.Eval(Container, "dataItem.Purchased")%>
If the above item is true i want to display "dataItem.PurchDate" & "dataItem.UserPurch"
and if the condition is false i want to display a Button (To tag item as purchased)..

<asp:Repeater id="MPItem" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr>
<th class="style1">Image</th>
<th>Items on this list</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>

<td class="style3"><img src="<%#DataBinder.Eval(Container, "dataItem.Image")%>" alt="" />
</td>

<td class="style4" style="vertical-align: top">
Name :
<%#DataBinder.Eval(Container, "dataItem.ItemName")%>
<br />
Description :
<%#DataBinder.Eval(Container, "dataItem.Description")%>
<br />
<a href ="<%#databinder.eval(Container, "dataItem.ShopLink")%>">Goto Shop</a>
<br /> Cost :
<%#DataBinder.Eval(Container, "dataItem.cost")%>
<%#DataBinder.Eval(Container, "dataItem.Currency")%>
<br />
Purchased :
<%#DataBinder.Eval(Container, "dataItem.Purchased")%> On
<%#DataBinder.Eval(Container, "dataItem.Purchdate")%> by
<%#DataBinder.Eval(Container, "dataItem.UserPurch")%>

<asp:Button ID="Butt" OnClick="Purchase" runat="server" Text="Tag this item Purchased" commandargument = <%#DataBinder.Eval(Container, "dataItem.DetID")%> />
</td>
</tr>
</ItemTemplate>


At the moment i only know how to display a fixed output, IE both show irespective of the condition...

Please Help me..

Thanks

Gremmy...

GremlinSA
June 13th, 2008, 06:18 PM
I eventualy got round to searching in depth i found out how to do this, from a google search i found this article on CG (http://www.codeguru.com/csharp/.net/net_asp/tutorials/article.php/c12065/)

so i guess i can wrap this thread up..