Difference between a custom template and a user control?

B

Barry

I have a DataList in which I need to dynamically load a
SelectedItemTemplate. However, I ended up turning the template into a
User Control because I needed code behind. The reason I did this was
because I have another DataList inside the template/control that has to
be bound to a function call and I couldn't figure out how to do this in
a template.

I'm still using MyDataList.SelectedItemTemplate =
LoadTemplate("./Path/To/MyControl.ascx"), which sort-of works. The
problem I'm having is that I want an item in my template/control to
reload the top Datalist with a different template/control when a certain
item is clicked in the sub-DataList and it doesn't seem to work.

Is there a difference between the two technologies? Did I not need to
use a User Control to get what I needed? I feel like I've read a ton on
these things and I get a little more confused every day. Can anyone
point me in the right direction?

TIA,
Barry
 
N

Natty Gur

Hi,

you can use public functions from the code behind to set Template
attribute values :

<ITEMTEMPLATE>
<P width="<%#New
Unit(Container.Width)%>"><%#GetSystemName(Container.DataItem)%></P>
</ITEMTEMPLATE>

Hope it helps you.



Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 

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

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top