Difference between a custom template and a user control?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Difference between a custom template and a user control?



    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



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Barry Guest

  2. Similar Questions and Discussions

    1. ASP.NET 2.0 User Control that implements a template
      I have created a user control in ASP.NET 2.0 that utilizes ITemplate. The control has no issues (displays fine in a browser) until I try to go into...
    2. How to custom gridview control if it derive from web user control?
      How to custom gridview control (modify column templates) if it derived from web user control? I have a web user control which contains one...
    3. Events in a custom template control
      I have written a template control which contains a button. I have added a public event to the control which I raise on the button's Click event. In...
    4. Custom Server Control works on page but not User Control...why?
      I'm developing the DevEdit.NET server control (an online HTML editor - www.devedit.com) but there's an extremely bizarre bug. The control runs fine...
    5. Page Load fired 3 times Web user control is embedded in a custom control
      Hi, I have built a custom control that build a table with 3 cells in it. The custom control is designed to add all child controls to cell#2,...
  3. #2

    Default Re: Difference between a custom template and a user control?

    Hi,

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

    <ITEMTEMPLATE>
    <P width="<%#New
    Unit(Container.Width)%>"><%#GetSystemName(Containe r.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


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139