[Mono-bugs] [Bug 77740][Nor] New - A listbox control should not render childrens (in RenderContents)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Mar 9 05:50:23 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by informatique.internet at fiducial.fr.

http://bugzilla.ximian.com/show_bug.cgi?id=77740

--- shadow/77740	2006-03-09 05:50:22.000000000 -0500
+++ shadow/77740.tmp.28952	2006-03-09 05:50:23.000000000 -0500
@@ -0,0 +1,120 @@
+Bug#: 77740
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Web
+AssignedTo: gonzalo at ximian.com                            
+ReportedBy: informatique.internet at fiducial.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: A listbox control should not render childrens (in RenderContents)
+
+Description of Problem:
+A listbox control should not render childrens (in RenderContents)
+
+Steps to reproduce the problem:
+1. I've done a personnal control that override
+System.Web.UI.WebControls.ListBox. The control should add a
+"HtmlInputHidden" at the end of the ListBoxControl :
+
+Here's is the code of my custom control
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.HtmlControls;
+using System.ComponentModel;
+using System.Resources;
+
+
+namespace TestsASPMono
+{
+	/// <summary>
+	/// Description résumée de ListBoxTest.
+	/// </summary>
+	public class ListBoxTest : System.Web.UI.WebControls.ListBox
+	{
+		public ListBoxTest():base()
+		{
+			
+		}
+		private HtmlInputHidden itemTracker;
+
+		public override System.Web.UI.ControlCollection Controls 
+		{
+			get 
+			{
+				EnsureChildControls();
+				return base.Controls;
+			}
+		}
+
+		protected override void CreateChildControls() 
+		{
+			base.CreateChildControls();
+			this.itemTracker = new HtmlInputHidden();
+			this.itemTracker.ID = "itemTracker";
+			this.itemTracker.Value="hello";
+			this.itemTracker.EnableViewState = false;
+			this.Controls.Add(itemTracker);
+		}
+		/// <summary>
+		/// Overridden to render children after the end tag.
+		/// </summary>
+		public override void RenderEndTag(System.Web.UI.HtmlTextWriter writer) 
+		{
+			base.RenderEndTag(writer);
+			this.RenderChildren(writer);
+		}		
+
+	}
+}
+
+Here's the code of my webpage which instanciate my usercontrol:
+
+		private void Page_Load(object sender, System.EventArgs e)
+		{
+			ListBoxTest listboxtest=new ListBoxTest();
+			listboxtest.Items.Add("hello1");
+			listboxtest.Items.Add("hello2");
+			this.PlaceHolder1.Controls.Add(listboxtest);
+		}
+
+
+Actual Results:
+On Mono the Html Rendered is :
+
+<select name="_ctl0" size="4">
+<input name="itemTracker" id="itemTracker" type="hidden" value="hello" />
+<option value="hello1">hello1</option>
+<option value="hello2">hello2</option>
+</select>
+<input name="itemTracker" id="itemTracker" type="hidden" value="hello" />
+
+Expected Results:
+
+On MS.NET the Html Rendered is : 
+
+<select name="_ctl0" size="4">
+<option value="hello1">hello1</option>
+<option value="hello2">hello2</option>
+</select>
+<input name="itemTracker" id="itemTracker" type="hidden" value="hello" />
+
+
+How often does this happen? 
+
+Always
+
+Additional Information:
+A Listbox ("<select>" in html) shouldn't contain other things than "<option/>"


More information about the mono-bugs mailing list