469,160 Members | 1,586 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,160 developers. It's quick & easy.

auto show/hide item's data

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 :)

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
1 2758
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

"lydia sista via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:20******************************@DotNetMonste r.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 :)

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Prowler | last post: by
2 posts views Thread by Greg | last post: by
4 posts views Thread by EdB | last post: by
1 post views Thread by shapper | last post: by
4 posts views Thread by magmike | last post: by
10 posts views Thread by laredotornado | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.