|
-
May 28th, 2003, 02:40 PM
#1
Thread Starter
yay gay
Databinding and DataList - help
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?
\m/  \m/
-
May 28th, 2003, 02:49 PM
#2
PowerPoster
Code:
label1.Text=<%# DataBinder.Eval(Container.DataItem, "columnName") %>
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.
Last edited by hellswraith; May 28th, 2003 at 02:55 PM.
-
May 28th, 2003, 03:04 PM
#3
Thread Starter
yay gay
how do i do that thru a datareader?
\m/  \m/
-
May 28th, 2003, 03:17 PM
#4
PowerPoster
datalist1.DataSource = myReader
datalist1.DataBind()
-
May 28th, 2003, 03:18 PM
#5
PowerPoster
Just to clarify, this line:
Code:
label1.Text=<%# DataBinder.Eval(Container.DataItem, "columnName") %>
goes in the html part, not the code.
-
May 28th, 2003, 03:41 PM
#6
Thread Starter
yay gay
ah after a lot of tweaking i think i did it! ty!
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|