<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET WebForms</title><link>https://www.dotnetzone.gr:443/cs/forums/13/ShowForum.aspx</link><description>Θέματα για web εφαρμογές, σε ASP.NET WebForms</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Δυναμικά templates σε DataList</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/9141.aspx</link><pubDate>Thu, 02 Feb 2006 17:45:28 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:9141</guid><dc:creator>Νατάσα Μανουσοπούλου</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/9141.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=13&amp;PostID=9141</wfw:commentRss><description>&lt;P&gt;Σήμερα το πρωί, με πιο καθαρό μυαλό, βρήκα&amp;nbsp;τι συμβαίνει, με τη βοήθεια του θεϊκού Reflector και πρέπει να το μοιραστώ οπωσδήποτε μαζί σας. &lt;/P&gt;
&lt;P&gt;Ο κώδικας της DataListItem.RenderItemInternal (από τον οποίο έπαιρνα το exception) είναι ο παρακάτω:&lt;/P&gt;
&lt;P&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;private&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; RenderItemInternal(HtmlTextWriter writer, &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;bool&lt;/span&gt; extractRows, &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;bool&lt;/span&gt; tableLayout)&lt;br /&gt;{&lt;br /&gt;      &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (!extractRows)&lt;br /&gt;      {&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (tableLayout)&lt;br /&gt;            {&lt;br /&gt;                  &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;this&lt;/span&gt;.RenderContents(writer);&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                  &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;base&lt;/span&gt;.RenderControl(writer);&lt;br /&gt;            }&lt;br /&gt;      }&lt;br /&gt;      &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;&lt;br /&gt;      {&lt;br /&gt;            IEnumerator enumerator1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;this&lt;/span&gt;.Controls.GetEnumerator();&lt;br /&gt;            Table table1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;null&lt;/span&gt;;&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;bool&lt;/span&gt; flag1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;false&lt;/span&gt;;&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;while&lt;/span&gt; (enumerator1.MoveNext())&lt;br /&gt;            {&lt;br /&gt;                  flag1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;;&lt;br /&gt;                  Control control1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; (Control) enumerator1.Current;&lt;br /&gt;                  &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (control1 &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;is&lt;/span&gt; Table)&lt;br /&gt;                  {&lt;br /&gt;                        table1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; (Table) control1;&lt;br /&gt;                        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;break&lt;/span&gt;;&lt;br /&gt;                  }&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (table1 !&lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;null&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                  IEnumerator enumerator2 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; table1.Rows.GetEnumerator();&lt;br /&gt;                  &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;while&lt;/span&gt; (enumerator2.MoveNext())&lt;br /&gt;                  {&lt;br /&gt;                        TableRow row1 &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; (TableRow) enumerator2.Current;&lt;br /&gt;                        row1.RenderControl(writer);&lt;br /&gt;                  }&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (flag1)&lt;br /&gt;            {&lt;br /&gt;                  &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;throw&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; HttpException(HttpRuntime.FormatResourceString(&lt;span style="color: #666666;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;"DataList_TemplateTableNotFound"&lt;/span&gt;, &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;this&lt;/span&gt;.Parent.ID, &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;this&lt;/span&gt;.itemType.ToString()));&lt;br /&gt;            }&lt;br /&gt;      }&lt;br /&gt;}&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Όπως φαίνεται λοιπόν εδώ, όταν το ExtractTemplateRows=true,&amp;nbsp;το DataListItem ελέγχει τα controls του για να βρει ένα Table control και να πάρει τις γραμμές του. Όμως, όταν το ItemTemplate έχει φορτωθεί από user control, τότε το DataListItem έχει ένα child control μόνο το οποίο είναι τύπου MyUserControl_ascx και βέβαια δεν είναι Table (αλλά το περιέχει). Οπότε Table δε βρίσκει, και ρίχνει το exception.&lt;/P&gt;
&lt;P&gt;Ποιο ήταν το workaround που έκανα με βάση αυτό; Στην OnPreRender, εφόσον το DataListItem περιέχει κάποιο user control (το οποίο έχει φορτωθεί από template) και το ExtractTemplateRows=true,&amp;nbsp;κάνω reparent τα child controls του user control στο DataListItem, οπότε βρίσκει τον πίνακα. Αυτό βέβαια είναι εφικτό δεδομένου ότι το user control δεν έχει καθόλου κώδικα από πίσω, οπότε μπορεί να εξαφανιστεί χωρίς συνέπειες.&lt;/P&gt;
&lt;P&gt;&lt;img src="/cs/emoticons/emotion-2.gif" alt="Big Smile [:D]" /&gt;&lt;/P&gt;</description></item><item><title>Απ: Δυναμικά templates σε DataList</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/9139.aspx</link><pubDate>Thu, 02 Feb 2006 17:13:24 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:9139</guid><dc:creator>Νατάσα Μανουσοπούλου</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/9139.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=13&amp;PostID=9139</wfw:commentRss><description>&lt;P&gt;Έχω λοιπόν ένα generic user control που περιέχει ένα data list στο οποίο θέλω να δείξω ένα τυχόν DataTable χτίζοντας τις κολώνες στο runtime με ένα συγκεκριμένο τρόπο (ο οποίος έχει προδιαγραφές για το πώς θα είναι το Item, το EditItem, το Header και το Footer). To DataList είναι κάπως έτσι:&lt;/P&gt;
&lt;P&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:DataList&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="allData"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;Width&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="100%"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;GridLines&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="None"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;ShowHeader&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="True"&lt;/span&gt;&lt;br /&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;BorderStyle&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="None"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;BorderWidth&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="0px"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;CellPadding&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="2"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;ShowFooter&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="True"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;ExtractTemplateRows&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="True"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;... (item styles μόνο)&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:DataList&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Και στην OnLoad του user control, καλείται κώδικας που κάνει το παρακάτω:&lt;/P&gt;
&lt;P&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt; &lt;br /&gt;&lt;br /&gt;   a_List.ExtractTemplateRows &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; strTemplateName &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;"~/Templates/"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; a_Data.TableName &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;"Item.ascx"&lt;/span&gt;;&lt;br /&gt;   CreateTemplate(a_Data, strTemplateName, TemplateType.Item);&lt;br /&gt;   a_List.ItemTemplate &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Page.LoadTemplate(strTemplateName);&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Η CreateTemplate γεννά με βάση τις στήλες του a_Data (DataTable)&amp;nbsp;ένα user control σαν κι αυτό:&lt;/P&gt;
&lt;P&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;%@ Language="c#" %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:Table&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableRow&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableCell&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;%# DataBinder.Eval(((DataListItem)Container).DataItem, "ID") %&amp;gt;&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableCell&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableCell&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;%# DataBinder.Eval(((DataListItem)Container).DataItem, "Description") %&amp;gt;&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableCell&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableRow&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:Table&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;και τα αντίστοιχα για τα άλλα templates, τα οποία επίσης ανατίθενται στο DataList.&lt;/P&gt;
&lt;P&gt;Πάνω στο rendering του control όμως παίρνω το exception που ανέφερα.&lt;/P&gt;
&lt;P&gt;Όσο και να έψαξα, βρήκα μόνο μια ερώτηση από έναν άλλο ταλαίπωρο που ρώταγε το ίδιο πράγμα και κανείς δεν του είχε απαντήσει. Ελπίζω ότι θα είμαι πιο τυχερή...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>Απ: Δυναμικά templates σε DataList</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/9119.aspx</link><pubDate>Thu, 02 Feb 2006 02:48:19 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:9119</guid><dc:creator>Χρήστος Γεωργακόπουλος</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/9119.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=13&amp;PostID=9119</wfw:commentRss><description>Δείξε λίγο κώδικα παραπάνω, πως βάζεις το controls μέσα και πως τα ψάχνεις μετά...</description></item><item><title>Δυναμικά templates σε DataList</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/9118.aspx</link><pubDate>Thu, 02 Feb 2006 02:03:07 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:9118</guid><dc:creator>Νατάσα Μανουσοπούλου</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/9118.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=13&amp;PostID=9118</wfw:commentRss><description>&lt;P&gt;Έχω ένα DataList στο οποίο θέτω προγραμματιστικά τα ItemTemplate, HeaderTemplate, FooterTemplate με την Page.LoadTemplate. Τα user controls που έχω σαν templates είναι της μορφής&lt;/P&gt;
&lt;P&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;%@ Language="c#" %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:Table&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;="Table2365"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableRow&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:TableRow&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;asp:Table&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To DataList έχει ExtractTemplateRows=true. Όμως τελικά παίρνω exception: &lt;EM&gt;A Table control was not found in the template for 'allCategories' for an item of type 'ListItemType.Header'.&lt;/EM&gt; &lt;/P&gt;
&lt;P&gt;Δοκίμασα να κάνω το LoadTemplate σε όλα τα πιθανά σημεία του κύκλου ζωής της σελίδας, χωρίς αποτέλεσμα. Καμία ιδέα;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item></channel></rss>