auto show/hide item's data

  • Thread starter lydia sista via DotNetMonster.com
  • Start date
L

lydia sista via DotNetMonster.com

hi! help...
How do you show/hide item's data?
Like sale item on product catalogue.
I want to show the sale image when the status of product is on sale.

in my catalogue I use datalist:
------------------------------------------------------------------
<ASP:DataList id="MyDataList" RepeatColumns="3" runat="server">
<ItemTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="center"> <a href='<%# "item.aspx?pid=" &
Container.DataItem("pid") %>'><img align="top" src='<%# DataBinder.Eval
(Container.DataItem, "img") %>' width="225" height="225" border=0>
</a> </td> </tr>
<tr>
<td valign="top" align="center">
<b>
<asp:HyperLink runat="server" Text='<%# DataBinder.Eval
(Container.DataItem, "pname") %>' NavigateUrl='<%# "item.aspx?pid=" &
Container.DataItem("pid") %>' ID="Hyperlink1"/> </b>
<br>
<%# DataBinder.Eval(Container.DataItem, "pdesc") %>
<br>
<b>
<asp:Label ID="sale" Runat=server></asp:Label>
<font color="#FF9900">SG
<%# DataBinder.Eval(Container.DataItem, "price", "$ {0}") %>
</font></b>
<p>
<a href='<%# DataBinder.Eval(Container.DataItem, "pid",
"shoppingcart.aspx?pid={0}") %>' >
<img border="0" src="../img/cartempty.gif"> </a>
</td>
</tr> </table> </ItemTemplate>
</ASP:DataList>
------------------------------------------------------------------

Here's my asp.net vb code:
------------------------------------------------------------------
Dim ds as dataset
'ds return dataset of results where category is Adult Costumes and
subcategory is Men
ds = P.getSub("*", "product", "category", "Adult Costumes",
"subcategory", "Men")

MyDataList.DataSource = ds.Tables("product").DefaultView
MyDataList.DataBind()
------------------------------------------------------------------

the tables product has a column name 'status' and the value will be 'sale'
if the product is on sale, else 'active'.
Do you have any idea how can i show/hide the sale image on the sale item in
the catalogue?
Thanks :)
 
E

Eliyahu Goldin

The easiest way is to handle ItemDataBound event. In the event you have
access to all columns of every item (row). You can check and set whatever
you want.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top