Accessing controls within a datalist footer template

P

Paul Maidment

Hi,

I am a bit green when it comes to .net development so
please excuse me if this question is obvious or has been
asked before...

I am trying to programmatically access a label control
within a datalist footer template using asp/vb.net. I have
been searching
through the documentation but can only find reference to
creating a footer template programatically, rather than
accessing the controls within one.

If anyone has done this, or can point me in the direction
of some sample code, that would be fantastic!

Cheers!
 
N

Nick Berardi

try this paul.

dataList_ItemDataBound (object sender, DataItemEventArgs e) {
if (e.Item.ItemType == ItemType.Footer) {
Label l = (Label)e.Cells[0].Controls("labelname");
l.Text = "New Text";
}
}

I don't have access to a program that I have done this in where you pull
out the cells and find a control with in them. But I think you will get
the basic understanding of what has to be done.

Nick
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top