Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox problem vb.net

Status
Not open for further replies.

orangelight

Technical User
Feb 17, 2005
20
GB
hi
I have a boolean field taken from a db record - how can i put this into a check box
i.e

if strboolean = true then
Chkboolean.checked = true (this should show the tick)
end if


<asp:checkbox id=Chkboolean runat="server" />

i can't get it t work - please help
thanks in advance
Hesh
 
hi
i did it this way becuase of other functions i have to do

Sub vb_main_content(ByVal l_parm_id)

Dim dtrNav As SqlDataReader
Dim oConn As SqlConnection
Dim connstring As String
Dim cmdSelect As SqlCommand

connstring = ConfigurationSettings.AppSettings("ConnectionString")
oConn = New SqlConnection(connstring)

'cmdSelect = New SqlCommand("Select * from tble_CapsDB_nav", oConn)
cmdSelect = New SqlCommand("sp_aspx_content", oConn)
cmdSelect.CommandType = CommandType.StoredProcedure
cmdSelect.Parameters.Add("@content_id", l_parm_id)


oConn.Open()

dtrNav = cmdSelect.ExecuteReader()


If dtrNav.Read() Then

frm_title.Text = dtrNav("content_title")
frmName.Text = dtrNav("content_name")
strboolean = dtrNav("Content_live")


End If
dtrNav.Close()
oConn.Close()

End Sub

thanks
 
If you are using a DataReader you could use the GetBoolean method and pass in the index of your column e.g.
Code:
CheckBox1.Checked = myDataReader.GetBoolean(0)


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top