well i have a datalist that has a label inside..now i want that label to get its .Text property from a table that i have in my mssql database using databinding...how can i achieve this?
Printable View
well i have a datalist that has a label inside..now i want that label to get its .Text property from a table that i have in my mssql database using databinding...how can i achieve this?
That is assuming you are getting a dataset, datareader, or datatable as the source for the datalist. You substitute the columnName for the actual columns text you want.Code:label1.Text=<%# DataBinder.Eval(Container.DataItem, "columnName") %>
how do i do that thru a datareader?
datalist1.DataSource = myReader
datalist1.DataBind()
Just to clarify, this line:
goes in the html part, not the code.Code:label1.Text=<%# DataBinder.Eval(Container.DataItem, "columnName") %>
ah after a lot of tweaking i think i did it! ty!