473,399 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 2917
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
9
by: Prowler | last post by:
In our current application we have a page whose sole purpose for existence is to permit the user to select from a list (subsequent to our login page). We would like to have the list drop down...
2
by: Greg | last post by:
Hello, I am trying to display order ids and order details (order items). I would like to give the user Hide/Show option to either display or hide order details. The page would look like: ...
4
by: EdB | last post by:
Does VB.Net provide any means of mimicking the behaviour of the auto hide/docking controls, such as the solution explorer and toolbox?
3
by: Jason | last post by:
How do I hide a column in a GridView in ASP.NET 2.0 when all of the columns are autogenerated based on the datasource? I want to hide the first of three columns, but the following doesn't work: ...
1
by: shapper | last post by:
Hello, I created an Asp:Repeater where I have an Asp:Panel and an Asp:Label. In each record of the repeater I want to have a small button which hides or shows the panel in that record. If...
4
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
6
by: TAL651 | last post by:
Hello, I am using javascript to show/hide nested lists. I modified some code originally posted by ACoder on an earlier thread. Currently, however, the page loads with everything showing. My...
10
by: laredotornado | last post by:
Hi, I'm using php 5. Does anyone have any code or a function that auto submits a form that contains a single INPUT, of type = file? Thanks, - Dave
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.