473,471 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

checkbox visible based on multiple rows

asp.net 2.0 and language is c#

I need to add a single checkbox on an aspx page based on evaluating
two aspects of the items the customer has placed in the shopping cart.

The price must be $100 or more and the brand must be a specific brand.
There may be multiple items in the cart but there can be only one
checkbox. I wrote some code on the codebehind, but it only evaluates
the last item in the cart. How can I evaluate all o the items?

Thanks in advance for any help.
Apr 9 '08 #1
4 1975
On Apr 9, 2:03*pm, duncfair <duncf...@gmail.comwrote:
asp.net 2.0 and language is c#

I need to add a single checkbox on an aspx page based on evaluating
two aspects of the items the customer has placed in the shopping cart.

The price must be $100 or more and the brand must be a specific brand.
There may be multiple items in the cart but there can be only one
checkbox. *I wrote some code on the codebehind, but it only evaluates
the last item in the cart. *How can I evaluate all o the items?

Thanks in advance for any help.
What did you write?

ni the code behind you should do something like:
bool isVisible = false;
foreach(Item item in Cart.Items)
if ( item. ..... condition)
{
isVisible = true;
break;
}
checkBox1.Vislble = isVisible;
Apr 9 '08 #2
What I have is pretty much what you wrote, but my the visible=true vs
visible=false is only 'looking at' the last item in the cart. Even if
I have an item that meets the criteria, if it's not the last item
added to the cart the checkbox is not visible.

On Apr 9, 12:52*pm, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Apr 9, 2:03*pm, duncfair <duncf...@gmail.comwrote:
asp.net 2.0 and language is c#
I need to add a single checkbox on an aspx page based on evaluating
two aspects of the items the customer has placed in the shopping cart.
The price must be $100 or more and the brand must be a specific brand.
There may be multiple items in the cart but there can be only one
checkbox. *I wrote some code on the codebehind, but it only evaluates
the last item in the cart. *How can I evaluate all o the items?
Thanks in advance for any help.

What did you write?

ni the code behind you should do something like:
bool isVisible = false;
foreach(Item item in Cart.Items)
* if ( item. ..... condition)
*{
* isVisible = true;
break;}

checkBox1.Vislble = isVisible;
Apr 9 '08 #3
On Apr 9, 5:26*pm, duncfair <duncf...@gmail.comwrote:
What I have is pretty much what you wrote, but my the visible=true vs
visible=false is only 'looking at' the last item in the cart. Even if
I have an item that meets the criteria, if it's not the last item
added to the cart the checkbox is not visible.

On Apr 9, 12:52*pm, "Ignacio Machin ( .NET/ C# MVP )"

<ignacio.mac...@gmail.comwrote:
On Apr 9, 2:03*pm, duncfair <duncf...@gmail.comwrote:
asp.net 2.0 and language is c#
I need to add a single checkbox on an aspx page based on evaluating
two aspects of the items the customer has placed in the shopping cart.
The price must be $100 or more and the brand must be a specific brand.
There may be multiple items in the cart but there can be only one
checkbox. *I wrote some code on the codebehind, but it only evaluates
the last item in the cart. *How can I evaluate all o the items?
Thanks in advance for any help.
What did you write?
ni the code behind you should do something like:
bool isVisible = false;
foreach(Item item in Cart.Items)
* if ( item. ..... condition)
*{
* isVisible = true;
break;}
checkBox1.Vislble = isVisible;- Hide quoted text -

- Show quoted text -
can you post your code?
maybe you confused "=" with "=="
Apr 10 '08 #4
Dansko_chkbx.Visible = false;
ProductDetailTableAdapter productadp = new
ProductDetailTableAdapter();
DataTable productdatatable =
productadp.GetDanskoProductDetailById(Convert.ToIn t32(Orderid.ToString()));
foreach (DataRow ProductDataRow in productdatatable.Rows)
{
DanskoPrice =
Convert.ToDecimal(ProductDataRow["Price"].ToString());
Danskobrandname =
ProductDataRow["BrandName"].ToString();

if ((Danskobrandname.Contains("Dansko")) &&
(DanskoPrice 100))
{
Dansko_chkbx.Visible = true;
}
else
{
Dansko_chkbx.Visible = false;
}
}
On Apr 10, 10:35*am, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Apr 9, 5:26*pm, duncfair <duncf...@gmail.comwrote:


What I have is pretty much what you wrote, but my the visible=true vs
visible=false is only 'looking at' the last item in the cart. Even if
I have an item that meets the criteria, if it's not the last item
added to the cart the checkbox is not visible.
On Apr 9, 12:52*pm, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Apr 9, 2:03*pm, duncfair <duncf...@gmail.comwrote:
asp.net 2.0 and language is c#
I need to add a single checkbox on an aspx page based on evaluating
two aspects of the items the customer has placed in the shopping cart.
The price must be $100 or more and the brand must be a specific brand.
There may be multiple items in the cart but there can be only one
checkbox. *I wrote some code on the codebehind, but it only evaluates
the last item in the cart. *How can I evaluate all o the items?
Thanks in advance for any help.
What did you write?
ni the code behind you should do something like:
bool isVisible = false;
foreach(Item item in Cart.Items)
* if ( item. ..... condition)
*{
* isVisible = true;
break;}
checkBox1.Vislble = isVisible;- Hide quoted text -
- Show quoted text -

can you post your code?
maybe you confused "=" with "=="- Hide quoted text -

- Show quoted text -
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Maziar Aflatoun | last post by:
Hi everyone, I am reading and displaying data rows from my database where the first column contains the Status checkbox. I like to enable my users to change the status of individual rows by...
2
by: Maziar Aflatoun | last post by:
Hi everyone, I am reading and displaying data rows from my database where the first column contains the Status checkbox. I like to enable my users to change the status of individual rows by...
1
by: sneha123 | last post by:
There will be some 20 questions and for each question there will be 4 choices.what i want to do is to select multiple answers by clicking the checkbox. i m using asp.net,vb.net pls help me we...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
4
by: arizal | last post by:
Hi , I am trying to figure out why my PHP code to delete multiple value by selecting the checkbox is not working. My php code is listed as below <?php $sql = "Select * from list;";...
0
by: cvijaykrishna | last post by:
i am having a web based application and i am having a problem with it pls check it Explanationi am sending a sample code plese see it in VS-2005 FOR BETTER UNFERSTANDING I have a main page...
3
by: yogarajan | last post by:
Hi All this is my page load event protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i <= 3; i++) { TableRow tr = new TableRow();
0
by: dotnetrookie | last post by:
Hi This is my 1st post.I have two checkbox columns in gridview binded through item template. The checkboxes are Category and Subcategory. I have actually removed the duplicate values in the...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.