Problem with display of check in checkbox retrived from database

Problem with display of check in checkbox retrived from database

am 23.02.2005 22:31:04 von jack

Hi,
I have an asp page where a check box is used. If the check box is checked
then the value goes to an Access database as "on" while if the checkbox is
unchecked before saving the asp page, the value of the checkbox that
goes to the access database is "off". The datatype in Acess is on/off.

When the page is retrived, the following code is applied. The response.write
statement shows when the value of checkbox stored in Access database is "On"
the result is True in asp page. While when the value of the checkbox stored
in the Access database is "Off" then the result in asp page is showing as
False.

l_IsChecked = RSCurrentExpense.Fields("IsChecked")
Response.Write l_IsChecked & "
"
Response.Write "Cool" & "
"

True
Cool

False
Cool



Now the way the value gets into the checkbox from the database is via the
following
code. However, when the checkbox value is true in asp, it does not show the
checkbox checked here. How can one transform the "true" value, so that the
checkbox would
show checked? Thanks for any help in advance.


Re: Problem with display of check in checkbox retrived from database

am 23.02.2005 22:55:31 von reb01501

Jack wrote:
> Now the way the value gets into the checkbox from the database is via
> the following
> code. However, when the checkbox value is true in asp, it does not
> show the checkbox checked here. How can one transform the "true"
> value, so that the checkbox would
> show checked? Thanks for any help in advance.
>
>
>

You have to set its checked attribute.

<% if cbool(l_IsChecked) then response.write " checked"%>
>

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: Problem with display of check in checkbox retrived from databa

am 24.02.2005 00:57:03 von jack

Thanks for your help Bob. This is something associated with the checkbox.
My data entry and data form is the same. Now when the asp page is trying to
retrive the value of checkbox from the database it cannot do so. Everytime it
shows the value as false. No idea why. Any thoughts. Thanks.
CODE:
l_IsChecked = RSCurrentExpense.Fields("IsChecked") 'This code is added to
handle the check button
Response.Write "Start Of ISchecked" & "
"
Response.Write l_IsChecked & "
"
Response.Write "Cool" & "
"

"Bob Barrows [MVP]" wrote:

> Jack wrote:
> > Now the way the value gets into the checkbox from the database is via
> > the following
> > code. However, when the checkbox value is true in asp, it does not
> > show the checkbox checked here. How can one transform the "true"
> > value, so that the checkbox would
> > show checked? Thanks for any help in advance.
> >
> >
> >
>
> You have to set its checked attribute.
>
> > <% if cbool(l_IsChecked) then response.write " checked"%>
> >
>
> HTH,
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>