Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - visible=true evaluation

Reply
 
Old 04-09-2008   #1 (permalink)
duncfair


 
 

visible=true evaluation

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.

My System SpecsSystem Spec
Old 04-09-2008   #2 (permalink)
Michel Racicot


 
 

Re: visible=true evaluation

That highly depends on two factors:

-Do you want to do this client side or server side?
-How is your data organized?

"duncfair" <duncfair@xxxxxx> wrote in message
news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
Quote:

> 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.

My System SpecsSystem Spec
Old 04-09-2008   #3 (permalink)
duncfair


 
 

Re: visible=true evaluation

Server side solution.

Data is MS SQL server and all datasets, etc. are accessed via stored
procedures.

On Apr 9, 11:59*am, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> That highly depends on two factors:
>
> -Do you want to do this client side or server side?
> -How is your data organized?
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
>
>
Quote:

> > asp.net 2.0 and language is c#
>
Quote:

> > 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.
>
Quote:

> > 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?
>
Quote:

> > Thanks in advance for any help.- Hide quoted text -
>
> - Show quoted text -
My System SpecsSystem Spec
Old 04-10-2008   #4 (permalink)
Michel Racicot


 
 

Re: visible=true evaluation

In that case, maybe the problem resides in the browsing of all item in the
cart.

Paste your stored procedure / SQL Code that must evaluate all items in the
cart and the code that handles the checkbox and maybe we can help you.


"duncfair" <duncfair@xxxxxx> wrote in message
news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
Server side solution.

Data is MS SQL server and all datasets, etc. are accessed via stored
procedures.

On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> That highly depends on two factors:
>
> -Do you want to do this client side or server side?
> -How is your data organized?
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
>
>
Quote:

> > asp.net 2.0 and language is c#
>
Quote:

> > 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.
>
Quote:

> > 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?
>
Quote:

> > Thanks in advance for any help.- Hide quoted text -
>
> - Show quoted text -

My System SpecsSystem Spec
Old 04-11-2008   #5 (permalink)
duncfair


 
 

Re: visible=true evaluation

The stored procedure is fine; SQL programming is my comfort zone.

Here is the code:

-------------------------------------------------------

Dansko_chkbx.Visible = false;
ProductDetailTableAdapter productadp = new
ProductDetailTableAdapter();
DataTable productdatatable =
productadp.GetDanskoProductDetailById(Convert.ToInt32(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, 6:24*am, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> In that case, maybe the problem resides in the browsing of all item in the
> cart.
>
> Paste your stored procedure / SQL Code that must evaluate all items in the
> cart and the code that handles the checkbox and maybe we can help you.
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
> Server side solution.
>
> Data is MS SQL server and all datasets, etc. are accessed via stored
> procedures.
>
> On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
>
>
Quote:

> > That highly depends on two factors:
>
Quote:

> > -Do you want to do this client side or server side?
> > -How is your data organized?
>
Quote:

> > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:

> >news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
Quote:
Quote:

> > > asp.net 2.0 and language is c#
>
Quote:
Quote:

> > > 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.
>
Quote:
Quote:

> > > 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?
>
Quote:
Quote:

> > > Thanks in advance for any help.- Hide quoted text -
>
Quote:

> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
My System SpecsSystem Spec
Old 04-11-2008   #6 (permalink)
Michel Racicot


 
 

Re: visible=true evaluation

This is the problem ...

You keep changing the visibility of your checkbox at every row because
Dansko_chkbx.Visible is set inside the foreach statement!!! (and it will be
set for every row, so the value it will get at the end will indeed be for
the last iteration of your foreach)





"duncfair" <duncfair@xxxxxx> wrote in message
news:b75bdad2-e7bc-4b36-b5f1-e4ddc8179bac@xxxxxx
The stored procedure is fine; SQL programming is my comfort zone.

Here is the code:

-------------------------------------------------------

Dansko_chkbx.Visible = false;
ProductDetailTableAdapter productadp = new
ProductDetailTableAdapter();
DataTable productdatatable =
productadp.GetDanskoProductDetailById(Convert.ToInt32(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, 6:24 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> In that case, maybe the problem resides in the browsing of all item in the
> cart.
>
> Paste your stored procedure / SQL Code that must evaluate all items in the
> cart and the code that handles the checkbox and maybe we can help you.
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
> Server side solution.
>
> Data is MS SQL server and all datasets, etc. are accessed via stored
> procedures.
>
> On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
>
>
Quote:

> > That highly depends on two factors:
>
Quote:

> > -Do you want to do this client side or server side?
> > -How is your data organized?
>
Quote:

> > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:

> >news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
Quote:
Quote:

> > > asp.net 2.0 and language is c#
>
Quote:
Quote:

> > > 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.
>
Quote:
Quote:

> > > 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?
>
Quote:
Quote:

> > > Thanks in advance for any help.- Hide quoted text -
>
Quote:

> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

My System SpecsSystem Spec
Old 04-11-2008   #7 (permalink)
duncfair


 
 

Re: visible=true evaluation

OK. So how do I evaluate if any of the rows meet the criteria?

On Apr 11, 12:55*pm, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> This is the problem ...
>
> You keep changing the visibility of your checkbox at every row because
> Dansko_chkbx.Visible is set inside the foreach statement!!! *(and it will be
> set for every row, so the value it will get at the end will indeed be for
> the last iteration of your foreach)
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:b75bdad2-e7bc-4b36-b5f1-e4ddc8179bac@xxxxxx
> The stored procedure is fine; SQL programming is my comfort zone.
>
> Here is the code:
>
> -------------------------------------------------------
>
> * * * * * * Dansko_chkbx.Visible = false;
> * * * * * * ProductDetailTableAdapter productadp = new
> ProductDetailTableAdapter();
> * * * * * * DataTable productdatatable =
> productadp.GetDanskoProductDetailById(Convert.ToInt32(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, 6:24 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
>
>
Quote:

> > In that case, maybe the problem resides in the browsing of all item in the
> > cart.
>
Quote:

> > Paste your stored procedure / SQL Code that must evaluate all items in the
> > cart and the code that handles the checkbox and maybe we can help you.
>
Quote:

> > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:

> >news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
> > Server side solution.
>
Quote:

> > Data is MS SQL server and all datasets, etc. are accessed via stored
> > procedures.
>
Quote:

> > On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
Quote:
Quote:

> > > That highly depends on two factors:
>
Quote:
Quote:

> > > -Do you want to do this client side or server side?
> > > -How is your data organized?
>
Quote:
Quote:

> > > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:
Quote:

> > >news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
Quote:
Quote:

> > > > asp.net 2.0 and language is c#
>
Quote:
Quote:

> > > > 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.
>
Quote:
Quote:

> > > > 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?
>
Quote:
Quote:

> > > > Thanks in advance for any help.- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -- Hide quoted text -
>
Quote:

> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
My System SpecsSystem Spec
Old 04-14-2008   #8 (permalink)
Michel Racicot


 
 

Re: visible=true evaluation

Sorry to tell you that but this is beginner's stuff... I highly suggest that
you try to understand what you're doing a little better before.

There is several way to achieve the result.

Since it can be for a school project and I don't want to give the answer
crudely, here comes a hint for one possible solution:

You can use a variable.

Another hint for another possible solution:

When if ((Danskobrandname.Contains("Dansko")) && (DanskoPrice > 100)) is
true, you don't even have to evaluate the reminder items. It saves some
iterations...

Good luck.


"duncfair" <duncfair@xxxxxx> wrote in message
news:78faa082-29d4-4442-b24f-09a560357341@xxxxxx
OK. So how do I evaluate if any of the rows meet the criteria?

On Apr 11, 12:55 pm, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> This is the problem ...
>
> You keep changing the visibility of your checkbox at every row because
> Dansko_chkbx.Visible is set inside the foreach statement!!! (and it will
> be
> set for every row, so the value it will get at the end will indeed be for
> the last iteration of your foreach)
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:b75bdad2-e7bc-4b36-b5f1-e4ddc8179bac@xxxxxx
> The stored procedure is fine; SQL programming is my comfort zone.
>
> Here is the code:
>
> -------------------------------------------------------
>
> Dansko_chkbx.Visible = false;
> ProductDetailTableAdapter productadp = new
> ProductDetailTableAdapter();
> DataTable productdatatable =
> productadp.GetDanskoProductDetailById(Convert.ToInt32(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, 6:24 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
>
>
Quote:

> > In that case, maybe the problem resides in the browsing of all item in
> > the
> > cart.
>
Quote:

> > Paste your stored procedure / SQL Code that must evaluate all items in
> > the
> > cart and the code that handles the checkbox and maybe we can help you.
>
Quote:

> > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:

> >news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
> > Server side solution.
>
Quote:

> > Data is MS SQL server and all datasets, etc. are accessed via stored
> > procedures.
>
Quote:

> > On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
Quote:
Quote:

> > > That highly depends on two factors:
>
Quote:
Quote:

> > > -Do you want to do this client side or server side?
> > > -How is your data organized?
>
Quote:
Quote:

> > > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:
Quote:

> > >news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
Quote:
Quote:

> > > > asp.net 2.0 and language is c#
>
Quote:
Quote:

> > > > 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.
>
Quote:
Quote:

> > > > 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?
>
Quote:
Quote:

> > > > Thanks in advance for any help.- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -- Hide quoted text -
>
Quote:

> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

My System SpecsSystem Spec
Old 04-14-2008   #9 (permalink)
duncfair


 
 

Re: visible=true evaluation

Thanks! I will end the loop when I get a 'true'.

Unfortunately, it's not a school project. I am a sql db programmer
struggling through web development tasks.

On Apr 14, 6:56*am, "Michel Racicot" <mraci...@xxxxxx> wrote:
Quote:

> Sorry to tell you that but this is beginner's stuff... I highly suggest that
> you try to understand what you're doing a little better before.
>
> There is several way to achieve the result.
>
> Since it can be for a school project and I don't want to give the answer
> crudely, here comes a hint for one possible solution:
>
> You can use a variable.
>
> Another hint for another possible solution:
>
> When if ((Danskobrandname.Contains("Dansko")) && (DanskoPrice > 100)) is
> true, you don't even have to evaluate the reminder items. *It saves some
> iterations...
>
> Good luck.
>
> "duncfair" <duncf...@xxxxxx> wrote in message
>
> news:78faa082-29d4-4442-b24f-09a560357341@xxxxxx
> OK. So how do I evaluate if any of the rows meet the criteria?
>
> On Apr 11, 12:55 pm, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
>
>
Quote:

> > This is the problem ...
>
Quote:

> > You keep changing the visibility of your checkbox at every row because
> > Dansko_chkbx.Visible is set inside the foreach statement!!! (and it will
> > be
> > set for every row, so the value it will get at the end will indeed be for
> > the last iteration of your foreach)
>
Quote:

> > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:

> >news:b75bdad2-e7bc-4b36-b5f1-e4ddc8179bac@xxxxxx
> > The stored procedure is fine; SQL programming is my comfort zone.
>
Quote:

> > Here is the code:
>
Quote:

> > -------------------------------------------------------
>
Quote:

> > Dansko_chkbx.Visible = false;
> > ProductDetailTableAdapter productadp = new
> > ProductDetailTableAdapter();
> > DataTable productdatatable =
> > productadp.GetDanskoProductDetailById(Convert.ToInt32(Orderid.ToString()));
> > foreach (DataRow ProductDataRow in productdatatable.Rows)
> > {
> > DanskoPrice =
> > Convert.ToDecimal(ProductDataRow["Price"].ToString());
> > Danskobrandname =
> > ProductDataRow["BrandName"].ToString();
>
Quote:

> > if ((Danskobrandname.Contains("Dansko")) &&
> > (DanskoPrice > 100))
> > {
> > Dansko_chkbx.Visible = true;}
>
Quote:

> > else
> > {
> > Dansko_chkbx.Visible = false;}
>
Quote:

> > }
>
Quote:

> > ----------------------------------------------
>
Quote:

> > On Apr 10, 6:24 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
Quote:
Quote:

> > > In that case, maybe the problem resides in the browsing of all item in
> > > the
> > > cart.
>
Quote:
Quote:

> > > Paste your stored procedure / SQL Code that must evaluate all items in
> > > the
> > > cart and the code that handles the checkbox and maybe we can help you.
>
Quote:
Quote:

> > > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:
Quote:

> > >news:236b2ede-ac1c-4fa7-9ed2-8446cdac1c54@xxxxxx
> > > Server side solution.
>
Quote:
Quote:

> > > Data is MS SQL server and all datasets, etc. are accessed via stored
> > > procedures.
>
Quote:
Quote:

> > > On Apr 9, 11:59 am, "Michel Racicot" <mraci...@xxxxxx> wrote:
>
Quote:
Quote:

> > > > That highly depends on two factors:
>
Quote:
Quote:

> > > > -Do you want to do this client side or server side?
> > > > -How is your data organized?
>
Quote:
Quote:

> > > > "duncfair" <duncf...@xxxxxx> wrote in message
>
Quote:
Quote:

> > > >news:2c30ce99-395d-43f9-b0dd-a714047c6ed7@xxxxxx
>
Quote:
Quote:

> > > > > asp.net 2.0 and language is c#
>
Quote:
Quote:

> > > > > 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.
>
Quote:
Quote:

> > > > > 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?
>
Quote:
Quote:

> > > > > Thanks in advance for any help.- Hide quoted text -
>
Quote:
Quote:

> > > > - Show quoted text -- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -- Hide quoted text -
>
Quote:

> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Operator -not should get True for whatever -eq 0 gets True (and morefun) PowerShell
SP1 Evaluation Vista General
True number of true Vista users Vista General
What is the true evaluation end date? Vista General
How can i unlock vista after evaluation has blocked start up. to extend the evaluation Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46