We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

binding data with label

hi all

how can i bind data in table with label control?
(label control is not inside any parent control, its an independent control in the webform.)

thanks

1 Reply

DE Deepak November 12, 2006 07:26 AM UTC

Simply use the label's text property with the data

for eg when u use the datareader to fetch the data from the database

use the following code


dim cmd as new Sqlcommand
cmd.commandType=commandType.text
cmd.connection =conn
cmd.commandText="Select name from EmployeeMaster"

dim rd as datareader
rd=cmd.executeReader()

if not isdbnull(rd.item("name"))
label1.text =(rd.item("name"))
endif

Thanks

Loader.
Live Chat Icon For mobile
Up arrow icon