473,626 Members | 3,289 Online
Bytes | Software Development & Data Engineering Community
+ 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 1992
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.Vislb le = 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.Vislb le = 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.Vislb le = isVisible;- Hide quoted text -

- Show quoted text -
can you post your code?
maybe you confused "=" with "=="
Apr 10 '08 #4
Dansko_chkbx.Vi sible = false;
ProductDetailTa bleAdapter productadp = new
ProductDetailTa bleAdapter();
DataTable productdatatabl e =
productadp.GetD anskoProductDet ailById(Convert .ToInt32(Orderi d.ToString()));
foreach (DataRow ProductDataRow in productdatatabl e.Rows)
{
DanskoPrice =
Convert.ToDecim al(ProductDataR ow["Price"].ToString());
Danskobrandname =
ProductDataRow["BrandName"].ToString();

if ((Danskobrandna me.Contains("Da nsko")) &&
(DanskoPrice 100))
{
Dansko_chkbx.Vi sible = true;
}
else
{
Dansko_chkbx.Vi sible = 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.Vislb le = 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
3637
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 checking and unchecking the checkbox column. I like to update the status in the database for the column where the status was changed. This is what I'm doing so far
2
6625
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 checking and unchecking the checkbox column. I like to update the status in the database for the column where the status was changed. This is what I'm doing so far
1
2911
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 have written the code using radio button for selecting single item.but we want to replace it with checkbox to select multiple items. the code using radio button is given below .pls correct it with checkbox
0
2798
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 chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2271
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 chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
4
11476
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;"; $result=mysql_query($sql) or die ("<br> Could not Retrieve Data <br>"); $num_rows=mysql_num_rows($result); While ($row =mysql_fetch_array($rs))
0
1429
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 called DEFAULT.ASPX it has a drop down list and 3 contentplace holders dropdown list With 3 parameters A,B,C if i select any options in drop down list the respective Content place holder will add respective user control and get Visible. for...
3
1804
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
2432
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 1st column so that Category is listed only once for the corresponding subcategories. Now I need to make sure that the all the subcategory checkboxes to be checked when the corresponding category checkbox is checked. The issue is that only the first...
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6126
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.