[Mono-bugs] [Bug 47697][Nor] New - ASP.NET: State is not restored from ViewState for dynamically created controls

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 18 Aug 2003 06:59:35 -0400 (EDT)


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 eric@veltman.nu.

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

--- shadow/47697	2003-08-18 06:59:35.000000000 -0400
+++ shadow/47697.tmp.29836	2003-08-18 06:59:35.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 47697
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Suse 8.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: eric@veltman.nu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ASP.NET: State is not restored from ViewState for dynamically created controls
+
+Description of Problem: 
+The state of controls that were dynamically created 
+from Page_Load is not restored from ViewState. 
+ 
+Steps to reproduce the problem: 
+1. Run the aspx that I pasted in the 
+   bottom of the description form field. 
+2. Notice that the dropdown contains items. 
+3. Click the button. 
+4. Notice that the dropdown doesn't contain items anymore. 
+ 
+Actual Results: 
+State of dynamically created control is not restored 
+from ViewState just after Page_Load. 
+ 
+Expected Results: 
+State of dynamically created control should be 
+restored from ViewState just after Page_Load. 
+ 
+How often does this happen?  
+For as far as I know, always. 
+ 
+Additional Information: 
+I'm using Mono 0.26, release version, compiled with 
+-d:NET_1_1 and I'm using the xsp 0.5 test web server. 
+ 
+<%@ language="C#" %> 
+<html> 
+<script runat=server> 
+	void Page_Load(object sender, EventArgs e) 
+	{ 
+		DropDownList DropDown = new DropDownList(); 
+		DropDown.ID = "DynamicDropDown"; 
+		PlaceHolder1.Controls.Add(DropDown); 
+ 
+		if(!IsPostBack) 
+		{ 
+			// Populate the dropdown. 
+			// We only do that 1 time, after that, the list 
+will be 
+			// repopulated just after Page_Load by the 
+ViewState mechanism. 
+			DropDown.Items.Add(new ListItem("Item 1")); 
+			DropDown.Items.Add(new ListItem("Item 2")); 
+			DropDown.Items.Add(new ListItem("Item 3")); 
+			DropDown.Items.Add(new ListItem("Item 4")); 
+		} 
+	} 
+ 
+</script> 
+<head> 
+<title>ViewState Restore Test</title> 
+</head> 
+<body> 
+<form runat="server"> 
+<asp:PlaceHolder id="PlaceHolder1" runat="server"/> 
+<asp:Button id="btn" 
+     Text="Postback" 
+     runat="server"/> 
+</form> 
+</body> 
+</html>