Check Box Question

  • Thread starter Thread starter JJ297
  • Start date Start date
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
 
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
 
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?
 
Put code in your codebehind page checkbox1.checkedchanged event that changes
one checkbox based on the checked value of the other.

Ross
 
Back
Top