|
 |
aspx_beginners thread: My conditionals seem to get ignored
Message #1 by "Brant Henne" <brant.henne@a...> on Fri, 4 Jan 2002 13:40:47
|
|
Hi,
I working in the Beginning ASP.NET using C#, and having trouble with
conditional statements in chapter 3. Using listpage.aspx as an example
from chapter 3, this is the type of conditional statement:
if(Request.Form["list"] != "")
{ ...follow proceedure displaying message.Text...
The book explains, and it seems to make sense, that this is designed to
show the message.Text plus the selection value only after a selection has
been made (the message.Text in fact equals "You have selected:"), but to
show nothing if a selection has not been made (like if a page has been
requested for the first time.
I downloaded the wrox copy of the code, and it has the same problem as my
code; ALL the .aspx pages in chapter 3 that have message.Text designed to
only be shown if some variable != "", are showing even if that variable
= "". Does anybody have any guidance on this? Does there need to be an
else statement? What's up? Thanks.
Message #2 by "Coco Lua Suat Choo" <CocoL@a...> on Mon, 7 Jan 2002 09:07:58 +0800
|
|
me too seems to have the same problem? is the example from the book
correct?
thanks!
-----Original Message-----
From: Brant Henne [mailto:brant.henne@a...]
Sent: Friday, January 04, 2002 9:41 PM
To: aspx_beginners
Subject: [aspx_beginners] My conditionals seem to get ignored
Hi,
I working in the Beginning ASP.NET using C#, and having trouble with
conditional statements in chapter 3. Using listpage.aspx as an example
from chapter 3, this is the type of conditional statement:
if(Request.Form["list"] !=3D "")
{ ...follow proceedure displaying message.Text...
The book explains, and it seems to make sense, that this is designed to
show the message.Text plus the selection value only after a selection
has
been made (the message.Text in fact equals "You have selected:"), but to
show nothing if a selection has not been made (like if a page has been
requested for the first time.
I downloaded the wrox copy of the code, and it has the same problem as
my
code; ALL the .aspx pages in chapter 3 that have message.Text designed
to
only be shown if some variable !=3D "", are showing even if that
variable
=3D "". Does anybody have any guidance on this? Does there need to be
an
else statement? What's up? Thanks.
$subst('Email.Unsub').
Message #3 by "Paul Birch" <paulbirch@b...> on Mon, 7 Jan 2002 19:15:45 -0000
|
|
Hi,
All the chapter three message statements are printed in the book as:
Message.Text = "some text saying what you have selected";
The label has been declared as
<aspx:label id="message" runat="server" />
Because C# is case sensitive, the Message.Text line should read:
message.Text ="some text saying what you have selected";
I sent the list to Wrox as bugs, but so far there has not been an update on
their pages.
Hope this helps,
Paul.
-----Original Message-----
From: Coco Lua Suat Choo [mailto:CocoL@a...]
Sent: Monday, January 07, 2002 01:08
To: aspx_beginners
Subject: [aspx_beginners] RE: My conditionals seem to get ignored
me too seems to have the same problem? is the example from the book
correct?
thanks!
-----Original Message-----
From: Brant Henne [mailto:brant.henne@a...]
Sent: Friday, January 04, 2002 9:41 PM
To: aspx_beginners
Subject: [aspx_beginners] My conditionals seem to get ignored
Hi,
I working in the Beginning ASP.NET using C#, and having trouble with
conditional statements in chapter 3. Using listpage.aspx as an example
from chapter 3, this is the type of conditional statement:
if(Request.Form["list"] != "")
{ ...follow proceedure displaying message.Text...
The book explains, and it seems to make sense, that this is designed to
show the message.Text plus the selection value only after a selection
has
been made (the message.Text in fact equals "You have selected:"), but to
show nothing if a selection has not been made (like if a page has been
requested for the first time.
I downloaded the wrox copy of the code, and it has the same problem as
my
code; ALL the .aspx pages in chapter 3 that have message.Text designed
to
only be shown if some variable != "", are showing even if that variable
= "". Does anybody have any guidance on this? Does there need to be an
else statement? What's up? Thanks.
$subst('Email.Unsub').
$subst('Email.Unsub').
Message #4 by "Brant Henne" <brant.henne@a...> on Tue, 8 Jan 2002 14:09:18
|
|
Thanks, Paul, but unfortunately this is not the issue. I had already
resolved this (it chokes on your mentioned case issue). Wrox seems to
have to faulty code (probably as result of the coding limbo) in ther
examples. My actual problem is that the message.Text is only supposed to
run if a value != null. That sounds logical for pages that have been
requested for the "first" time. Only thing is that it doesn't adhere to
that statement, and the message.Text ALWAYS gets generated. run the
example to get the full drift... I'd be curious to hear from anybody who
didn't have this problem, and find out what specs they are running. Thanks
B
Hi,
>
> All the chapter three message statements are printed in the book as:
> Message.Text = "some text saying what you have selected";
>
> The label has been declared as
> <aspx:label id="message" runat="server" />
>
> Because C# is case sensitive, the Message.Text line should read:
> message.Text ="some text saying what you have selected";
>
> I sent the list to Wrox as bugs, but so far there has not been an update
on
> their pages.
>
> Hope this helps,
>
> Paul.
Message #5 by "Douglas J. Badin" <DJBadin@m...> on Tue, 8 Jan 2002 11:37:33 -0500
|
|
Can you say Sloppy job.
The C# book is really the VB book. The translation to C# was not very
good.
C# is case-sensitive, hence Paul's point. The code works in VB, not C#.
C# will make you a better programmer.
The problem you are seeing is that the first time value is a null. This
does not convert to "" as in VB.
We are probably better off using the VB book and doing our own
translations.
However, it does provide for good learning, but at who's cost.
Doug
-----Original Message-----
From: Brant Henne [mailto:brant.henne@a...]
Sent: Tuesday, January 08, 2002 2:09 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: My conditionals seem to get ignored
Thanks, Paul, but unfortunately this is not the issue. I had already
resolved this (it chokes on your mentioned case issue). Wrox seems to
have to faulty code (probably as result of the coding limbo) in ther
examples. My actual problem is that the message.Text is only supposed
to run if a value != null. That sounds logical for pages that have been
requested for the "first" time. Only thing is that it doesn't adhere to
that statement, and the message.Text ALWAYS gets generated. run the
example to get the full drift... I'd be curious to hear from anybody
who didn't have this problem, and find out what specs they are running.
Thanks
B
Hi,
>
> All the chapter three message statements are printed in the book as:
> Message.Text = "some text saying what you have selected";
>
> The label has been declared as
> <aspx:label id="message" runat="server" />
>
> Because C# is case sensitive, the Message.Text line should read:
> message.Text ="some text saying what you have selected";
>
> I sent the list to Wrox as bugs, but so far there has not been an
> update
on
> their pages.
>
> Hope this helps,
>
> Paul.
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
|
|
 |