<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/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>Search results matching tag 'parsechildren'</title><link>http://forums.asp.net/search/SearchResults.aspx?q=&amp;tag=parsechildren&amp;orTags=0&amp;o=DateDescending</link><description>Search results matching tag 'parsechildren'</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Designer visibility of templated server control children</title><link>http://forums.asp.net/thread/1987560.aspx</link><pubDate>Fri, 02 Nov 2007 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1987560</guid><dc:creator>ScottyMac</dc:creator><description>&lt;p&gt;Hello World,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have&amp;nbsp;templated custom server control, which works ok, but the visual studio designer&lt;br /&gt;cannot properly &amp;quot;see&amp;quot; the child controls within the template, for code-behind work and the such.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;cc1:mycontrol runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;template&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;asp:label runat=&amp;quot;server&amp;quot; id=&amp;quot;mylabel&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/template&amp;gt;&lt;br /&gt;&amp;lt;/cc1:mycontrol&amp;gt;&lt;/p&gt;
&lt;p&gt;If i set the PersistChilden/ParseChildren one way (false/true), visual studio does not &amp;quot;see&amp;quot; the MyLabel&lt;br /&gt;control and gives an undefined variable compile error.&amp;nbsp; If I set them the other way (true/false), then i&lt;br /&gt;can no longer use FindControl to find Mylabel by searching the page control hierarchy.&lt;/p&gt;
&lt;p&gt;Any hints on how to get both methods to work?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Latest release has problem with custom controls w/ParseChildren(false)...?</title><link>http://forums.asp.net/thread/1785488.aspx</link><pubDate>Tue, 03 Jul 2007 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1785488</guid><dc:creator>rodrigoelp</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span&gt;Erm, I would
like to know if you guys could resolve this problem.&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;Currently I
am having the same issue, my control is a little different than the proposed in
the topic, but I am having the same error message and I have tried almost
everything (obviously not the right things.)&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;My problem
is described next:&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;I am having
a custom UserControl with a generic list containing class instances of a class I
made. The UserControl also has the ParseChildren attribute with the parsing flag
on true and the default property named to my List of elements.&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;When I write
the control tag name everything is ok, the intellisense shows everything and
compiles ok. In fact my only problem is when I switch back to design mode
getting the “Type ‘System.Web.UI.UserControl’ does not have a property named ‘ObjectListItem’”
which is the class’ name of the item stored within the generic list.&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;This is a
big issue for me because the designers are complaining about the page layout
when trying to edit anything or just move the controls. And i would like to know if theres a workaround or what i am doing wrong to correct it as fast as possible. Thanks.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;Here is the source code sample where you can reproduce the error:&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is the element code which will contain the information.&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&lt;b&gt;&lt;span class="cmt"&gt;//Item to store within the UserControl.&lt;/span&gt;&lt;/b&gt;
&lt;b id="2"&gt;2    &lt;/b&gt;&lt;b&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; CustomControls&lt;br /&gt;&lt;/b&gt;&lt;b id="3"&gt;3    &lt;/b&gt;&lt;b&gt;{&lt;br /&gt;&lt;/b&gt;&lt;b id="4"&gt;4    &lt;/b&gt;&lt;b&gt;    &lt;span class="kwd"&gt;public class&lt;/span&gt; MyItem&lt;br /&gt;&lt;/b&gt;&lt;b id="5"&gt;5    &lt;/b&gt;&lt;b&gt;    {&lt;br /&gt;&lt;/b&gt;&lt;b id="6"&gt;6    &lt;/b&gt;&lt;b&gt;        &lt;span class="kwd"&gt;private string&lt;/span&gt; m_Name;&lt;br /&gt;&lt;/b&gt;&lt;b id="7"&gt;7    &lt;/b&gt;&lt;b&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; Name&lt;br /&gt;&lt;/b&gt;&lt;b id="8"&gt;8    &lt;/b&gt;&lt;b&gt;        {&lt;br /&gt;&lt;/b&gt;&lt;b id="9"&gt;9    &lt;/b&gt;&lt;b&gt;            &lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; m_Name; }&lt;br /&gt;&lt;/b&gt;&lt;b id="10"&gt;10   &lt;/b&gt;&lt;b&gt;            &lt;span class="kwd"&gt;set&lt;/span&gt; { m_Name = &lt;span class="kwd"&gt;value&lt;/span&gt;; }&lt;br /&gt;&lt;/b&gt;&lt;b id="11"&gt;11   &lt;/b&gt;&lt;b&gt;        }&lt;br /&gt;&lt;/b&gt;&lt;b id="12"&gt;12   &lt;/b&gt;&lt;b&gt;    }&lt;br /&gt;&lt;/b&gt;&lt;b id="13"&gt;13   &lt;/b&gt;&lt;b&gt;}&lt;/b&gt;
&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is the Custom web UserControl code behind.&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;b id="2"&gt;2    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Data;&lt;br /&gt;&lt;b id="3"&gt;3    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Configuration;&lt;br /&gt;&lt;b id="4"&gt;4    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Collections;&lt;br /&gt;&lt;b id="5"&gt;5    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web;&lt;br /&gt;&lt;b id="6"&gt;6    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.Security;&lt;br /&gt;&lt;b id="7"&gt;7    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI;&lt;br /&gt;&lt;b id="8"&gt;8    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;b id="9"&gt;9    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;&lt;br /&gt;&lt;b id="10"&gt;10   &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;&lt;br /&gt;&lt;b id="11"&gt;11   &lt;/b&gt;
&lt;b id="12"&gt;12   &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;b id="13"&gt;13   &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; CustomControls;&lt;br /&gt;&lt;b id="14"&gt;14   &lt;/b&gt;
&lt;b id="15"&gt;15   &lt;/b&gt;[ParseChildren(&lt;span class="kwd"&gt;true&lt;/span&gt;, &lt;span class="st"&gt;&amp;quot;ItemList&amp;quot;&lt;/span&gt;)]&lt;br /&gt;&lt;b id="16"&gt;16   &lt;/b&gt;[PersistChildren(&lt;span class="kwd"&gt;false&lt;/span&gt;)]&lt;br /&gt;&lt;b id="17"&gt;17   &lt;/b&gt;[PersistenceMode(PersistenceMode.InnerProperty)]&lt;br /&gt;&lt;b id="18"&gt;18   &lt;/b&gt;&lt;span class="kwd"&gt;public&lt;/span&gt; partial &lt;span class="kwd"&gt;class&lt;/span&gt; controls_MyWebUserControl : System.Web.UI.UserControl&lt;br /&gt;&lt;b id="19"&gt;19   &lt;/b&gt;{&lt;br /&gt;&lt;b id="20"&gt;20   &lt;/b&gt;    &lt;span class="kwd"&gt;private&lt;/span&gt; List m_Items = &lt;span class="kwd"&gt;new&lt;/span&gt; List();&lt;br /&gt;&lt;b id="21"&gt;21   &lt;/b&gt;    &lt;span class="kwd"&gt;public&lt;/span&gt; List ItemList &lt;span class="cmt"&gt;//this is the element not found by the designer.&lt;/span&gt;
&lt;b id="22"&gt;22   &lt;/b&gt;    {&lt;br /&gt;&lt;b id="23"&gt;23   &lt;/b&gt;        &lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; m_Items; }&lt;br /&gt;&lt;b id="24"&gt;24   &lt;/b&gt;    }&lt;br /&gt;&lt;b id="25"&gt;25   &lt;/b&gt;    &lt;span class="kwd"&gt;protected void&lt;/span&gt; Page_Load(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e) { }&lt;br /&gt;&lt;b id="26"&gt;26   &lt;/b&gt;
&lt;b id="27"&gt;27   &lt;/b&gt;    &lt;span class="kwd"&gt;protected override void&lt;/span&gt; CreateChildControls()&lt;br /&gt;&lt;b id="28"&gt;28   &lt;/b&gt;    {&lt;br /&gt;&lt;b id="29"&gt;29   &lt;/b&gt;        &lt;span class="kwd"&gt;if&lt;/span&gt; (&lt;span class="kwd"&gt;this&lt;/span&gt;.DropDownList1.Items.Count != ItemList.Count)&lt;br /&gt;&lt;b id="30"&gt;30   &lt;/b&gt;        {&lt;br /&gt;&lt;b id="31"&gt;31   &lt;/b&gt;            &lt;span class="kwd"&gt;for&lt;/span&gt; (&lt;span class="kwd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; ItemList.Count; i++)&lt;br /&gt;&lt;b id="32"&gt;32   &lt;/b&gt;            {&lt;br /&gt;&lt;b id="33"&gt;33   &lt;/b&gt;                &lt;span class="kwd"&gt;this&lt;/span&gt;.DropDownList1.Items.Add(&lt;span class="kwd"&gt;new&lt;/span&gt; ListItem(ItemList[i].Name, ItemList[i].Name));&lt;br /&gt;&lt;b id="34"&gt;34   &lt;/b&gt;            }&lt;br /&gt;&lt;b id="35"&gt;35   &lt;/b&gt;        }&lt;br /&gt;&lt;b id="36"&gt;36   &lt;/b&gt;        &lt;span class="kwd"&gt;base&lt;/span&gt;.CreateChildControls();&lt;br /&gt;&lt;b id="37"&gt;37   &lt;/b&gt;    }&lt;br /&gt;&lt;b id="38"&gt;38   &lt;/b&gt;    &lt;span class="kwd"&gt;protected void&lt;/span&gt; Button1_Click(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e){ }&lt;br /&gt;&lt;b id="39"&gt;39   &lt;/b&gt;}&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;&lt;/b&gt;This is the UserControl ascx.&lt;/pre&gt;&lt;pre class="coloredcode"&gt;&lt;pre class="coloredcode"&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&amp;lt;%@ Control Language=&lt;span class="st"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; AutoEventWireup=&lt;span class="st"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; CodeFile=&lt;span class="st"&gt;&amp;quot;MyWebUserControl.ascx.cs&amp;quot;&lt;/span&gt; Inherits=&lt;span class="st"&gt;&amp;quot;controls_MyWebUserControl&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&lt;b id="2"&gt;2    &lt;/b&gt;&lt;b&gt;&amp;lt;-asp:Label&lt;/b&gt;&lt;b id="2"&gt; &lt;/b&gt;&amp;quot;Label1&amp;quot; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; Text=&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&amp;gt;
&lt;b id="3"&gt;3    &lt;/b&gt;&lt;b&gt;&amp;lt;-asp:TextBox&lt;/b&gt; &amp;quot;TextBox1&amp;quot; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;
&lt;b id="4"&gt;4    &amp;lt;-asp:DropDownList &lt;/b&gt;&amp;quot;DropDownList1&amp;quot; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;%-- I had to add a line between the asp flag to avoid the tool from removing it. --%&amp;gt;&lt;br /&gt;&lt;b id="5"&gt;5    &lt;/b&gt;
&lt;b id="6"&gt;6    &lt;/b&gt;&lt;b&gt;&amp;lt;-asp:Button&lt;/b&gt; &amp;quot;Button1&amp;quot; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; OnClick=&lt;span class="st"&gt;&amp;quot;Button1_Click&amp;quot;&lt;/span&gt; Text=&lt;span class="st"&gt;&amp;quot;Button&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;pre class="coloredcode"&gt;Code in the aspx page where i want the control with some parameters. There is no need to add extra code behind to the page except the one auto generated by vs.&lt;/pre&gt;&lt;pre class="coloredcode"&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&amp;lt;%@ Page Language=&lt;span class="st"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; AutoEventWireup=&lt;span class="st"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; CodeFile=&lt;span class="st"&gt;&amp;quot;Default.aspx.cs&amp;quot;&lt;/span&gt; Inherits=&lt;span class="st"&gt;&amp;quot;_Default&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&lt;b id="2"&gt;2    &lt;/b&gt;&amp;lt;%@ Register TagPrefix=&lt;span class="st"&gt;&amp;quot;custom&amp;quot;&lt;/span&gt; Namespace=&lt;span class="st"&gt;&amp;quot;CustomControls&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&lt;b id="3"&gt;3    &lt;/b&gt;&amp;lt;%@ Register src=&lt;span class="st"&gt;&amp;quot;~/controls/MyWebUserControl.ascx&amp;quot;&lt;/span&gt; TagName=&lt;span class="st"&gt;&amp;quot;MyWebUserControl&amp;quot;&lt;/span&gt; TagPrefix=&lt;span class="st"&gt;&amp;quot;custom&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&lt;b id="4"&gt;4    &lt;/b&gt;&lt;span class="st"&gt;&amp;quot;-&lt;span class="cmt"&gt;//W3C//DTD XHTML 1.1//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&amp;quot;&amp;gt;&lt;/span&gt;
&lt;b id="5"&gt;5    &lt;/b&gt;&amp;lt;-html xmlns=&amp;quot;&lt;/span&gt;http:&lt;span class="cmt"&gt;//www.w3.org/1999/xhtml&amp;quot;&amp;gt;&lt;/span&gt;
&lt;b id="6"&gt;6    &lt;/b&gt;&amp;lt;-head runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;b id="7"&gt;7    &lt;/b&gt;    &amp;lt;-title&amp;gt;Test Page&lt;br /&gt;&lt;b id="8"&gt;8    &lt;/b&gt;&amp;lt;-/head&amp;gt;&lt;br /&gt;&lt;b id="9"&gt;9    &lt;/b&gt;&amp;lt;-body&amp;gt;&lt;br /&gt;&lt;b id="10"&gt;10   &lt;/b&gt;    &amp;lt;-form id=&lt;span class="st"&gt;&amp;quot;form1&amp;quot;&lt;/span&gt; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;b id="11"&gt;11   &lt;/b&gt;        &amp;lt;-asp:ScriptManager ID=&lt;span class="st"&gt;&amp;quot;ScriptManager1&amp;quot;&lt;/span&gt; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;b id="12"&gt;12   &lt;/b&gt;        &amp;lt;-div&amp;gt;&lt;br /&gt;&lt;b id="13"&gt;13   &lt;/b&gt;            &amp;lt;-custom:MyWebUserControl ID=&lt;span class="st"&gt;&amp;quot;xx1&amp;quot;&lt;/span&gt; runat=&lt;span class="st"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;b id="14"&gt;14   &lt;/b&gt;                &amp;lt;-custom:MyItem Name=&lt;span class="st"&gt;&amp;quot;Item name 1&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;b id="15"&gt;15   &lt;/b&gt;                &amp;lt;-custom:MyItem Name=&lt;span class="st"&gt;&amp;quot;Item name 2&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;b id="16"&gt;16   &lt;/b&gt;                &amp;lt;-custom:MyItem Name=&lt;span class="st"&gt;&amp;quot;Item name 3&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;b id="17"&gt;17   &lt;/b&gt;                &amp;lt;-custom:MyItem Name=&lt;span class="st"&gt;&amp;quot;Item name 4&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;b id="18"&gt;18   &lt;/b&gt;            &amp;lt;-/custom:MyWebUserControl&amp;gt;&lt;br /&gt;&lt;b id="19"&gt;19   &lt;/b&gt;        &amp;lt;-/div&amp;gt;&lt;br /&gt;&lt;b id="20"&gt;20   &lt;/b&gt;    &amp;lt;-/form&amp;gt;&lt;br /&gt;&lt;b id="21"&gt;21   &lt;/b&gt;&amp;lt;-/body&amp;gt;&lt;br /&gt;&lt;b id="22"&gt;22   &lt;/b&gt;&amp;lt;-/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;&lt;/b&gt;&lt;b id="22"&gt;&lt;/b&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;pre class="coloredcode"&gt;Compile and switch to design mode in the default.aspx page (or anyone that you may have done containing the UserControl).&amp;nbsp;&lt;/pre&gt;&lt;pre class="coloredcode"&gt;Thanks in advance.&lt;/pre&gt;&lt;/pre&gt;&amp;nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>