Datalist with a summarized field

E

Ed

Hi All,

I have a datalist control that shows a dataset content from a Sql Server
database.
I´d like to show a summarized field (one of the dataset fields) after
the datalist is loaded.
How can I do this?, is there any way to do this using the footer
template ? or some other alternative ?

tks
Ed
 
K

Ken Cox [Microsoft MVP]

Hi Ed,

The footer sounds like a good place for that. You can insert most any text
you want. Just drop a label control into the footer in design view and then
jam in the text value (from the database) on the ItemDataBound event as
shown below:

Private Sub DataList1_ItemDataBound _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) _
Handles DataList1.ItemDataBound
Dim lblNew As Label
If e.Item.ItemType = ListItemType.Footer Then
lblNew = e.Item.FindControl("Label1")
lblNew.Text = "SQL data value here: " & Now.ToString
End If
End Sub

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top