472,984 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 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 1951
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: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.