471,305 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 1879
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Maziar Aflatoun | last post: by
2 posts views Thread by Maziar Aflatoun | last post: by
reply views Thread by rosydwin | last post: by

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.