I have a checkox on a web form that I would on Page_Load to display it's value from the database, i.e. either checked or unchecked. The database field name is 'Emailed' and set to type BIT, thus only having 1 or 0.
Now on my ASP.NET web form for updating, I have a Data Reader that checks the values from the database and displays these values via textboxes, dropdownlists, and checkboxes, but I am having trouble displaying the checkboxes correct.
For example, if the value in the DB is 1, then I want the checkbox to be CHECKED and vice versa. But I am seeing is the word 'TRUE' or 'FALSE' next to my checkboxes.
This is what I have:
<asp:CheckBox ID="chkEmail" Runat="server" Text="<%# strEmailed %>" />
[/red]
I am certain I have to incorporate the following but it doesn't work:
Checked='<%# DataBinder.Eval(Container, "DataItem.Emailed"
%>'
[/red]
FYI, in my code section I have something like this:
' a lot of code has been intentionally left out[/red]
Dim ..., strEmailed, ... AS String
Sub BindData()
While objDR.Read()
...
strEmailed=objDR("Emailed"
...
End While
page.databind()
End Sub
[/blue]
Anyone's assistance will be greatly appreciated.
Now on my ASP.NET web form for updating, I have a Data Reader that checks the values from the database and displays these values via textboxes, dropdownlists, and checkboxes, but I am having trouble displaying the checkboxes correct.
For example, if the value in the DB is 1, then I want the checkbox to be CHECKED and vice versa. But I am seeing is the word 'TRUE' or 'FALSE' next to my checkboxes.
This is what I have:
<asp:CheckBox ID="chkEmail" Runat="server" Text="<%# strEmailed %>" />
[/red]
I am certain I have to incorporate the following but it doesn't work:
Checked='<%# DataBinder.Eval(Container, "DataItem.Emailed"
[/red]
FYI, in my code section I have something like this:
' a lot of code has been intentionally left out[/red]
Dim ..., strEmailed, ... AS String
Sub BindData()
While objDR.Read()
...
strEmailed=objDR("Emailed"
...
End While
page.databind()
End Sub
[/blue]
Anyone's assistance will be greatly appreciated.