Groups | Blog | Home
all groups > inetserver asp db > february 2005 >

inetserver asp db : Problem with display of check in checkbox retrived from database


Jack
2/23/2005 1:31:04 PM

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 & "<br>"
Response.Write "Cool" & "<br>"

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.


<i><input type="checkbox" name="chk_Complete" value="<%Response.Write
Jack
2/23/2005 3:57:03 PM
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" & "<br>"
Response.Write l_IsChecked & "<br>"
Response.Write "Cool" & "<br>"

[quoted text, click to view]
Bob Barrows [MVP]
2/23/2005 4:55:31 PM
[quoted text, click to view]

You have to set its checked attribute.

<input type="checkbox" name="chk_Complete" value="<%=
l_IsChecked%>"
<% if cbool(l_IsChecked) then response.write " checked"%>
[quoted text, click to view]

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"

AddThis Social Bookmark Button