Check Box Question

J

JJ297

I need some assistance with a check box question.

I have two check boxes on a page:

<asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /
<asp:CheckBox
ID="ChkNo" runat="server" Text="No" />


This is under button_Click

My two fields in the databse
Dim displayedQues As Boolean = True
Dim nonDisplayedQues As Boolean = True

ChkYes.Text = "Y"
ChkNo.Text = "N"

If (ChkYes.Checked) Then
displayedQues = True
End If

If (ChkNo.Checked) Then
nonDisplayedQues = True
End If

It's going into the database now but I'm able to select both options
on the other page and when it goes into the database the values are 1
and 0 instead of Y and N.

What am I doing wrong?

Thanks in advance
 
M

Mark Fitzpatrick

Is the database a boolean value? If so that Y or N is not what you would see
in a database. Booleans typically use bits, 1 for True, 0 for False. Saves a
lot of space in the database. Not sure what you mean about selecting both
options on the other page.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
J

JJ297

Is the database a boolean value? If so that Y or N is not what you would see
in a database. Booleans typically use bits, 1 for True, 0 for False. Saves a
lot of space in the database. Not sure what you mean about selecting both
options on the other page.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
















- Show quoted text -

Thanks Mark,

In the database I have it listed as Char. I changed it and now it's
working properly.

On the design page I can select the both boxes yes and no and they
both will go into the database with Y and N answers how do I make the
user select one check box at a time?
 
R

Ross Culver

Put code in your codebehind page checkbox1.checkedchanged event that changes
one checkbox based on the checked value of the other.

Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top