controls in a dataLIST

X

xcervera

I've created a datalist that has a group of controls within its item template (sometimes there are more than one control in a coloumn). I need to access some of the properties of these controls but my problem is that I can't find a way to get to them.

Does any one know how to get to these controls (using the control name) in order to access their properties?

Thanks.
 
E

Eidolon

You can go one of two ways (maybe there are more, i dont know):

assuming you have the List.Item.ItemIndex you are trying to look (called
here idx) at and your list is called myList

1. myList.Items(idx).Controls(1) <==== Controls(#) to point to which ever
control you want

2. myList.Items(idx).FindControl("mySubControlName")


xcervera said:
I've created a datalist that has a group of controls within its item
template (sometimes there are more than one control in a coloumn). I need to
access some of the properties of these controls but my problem is that I
can't find a way to get to them.
Does any one know how to get to these controls (using the control name) in
order to access their properties?
 
X

Xaviero

Is it possible to change the contol in the itemTemplate so I don't have to make the change in the ItemBind for each one?
 
E

Eidolon

If its mostly all simple databinding, property values or simple formatting
you should be able to i would think.
I know you can get pretty far doing that with the itemtemplate in the
datagrid, though ive never actually used the datalist.
If you want to any kind of fancy variable formatting or such based on some
logic vs. a straightforward, its usually easier to do it in ItemDataBind (in
my opinion).

Xaviero said:
Is it possible to change the contol in the itemTemplate so I don't have to
make the change in the ItemBind for each one?
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top