CompositeDataBoundControl designer crashes VS2008
-
I'm building a very simple composite control and when use the designer to select a data source it crashes Visual Studio 2008. Here is the code:
namespace WebControlDesigner {
[ToolboxData("<{0}:ControlWithTasks runat=\"server\"></{0}:ControlWithTasks>")]
public class ControlWithTasks : CompositeDataBoundControl {public ControlWithTasks() : base() { } \[Category("Apearance")\] \[DefaultValue("Your Birthday")\] public string Prompt { get { return (string)ViewState\["Prompt"\] ?? "Your Birthday"; } set { ViewState\["Prompt"\] = value; } } \[Category("Data")\] \[Bindable(true)\] public DateTime Birthday { get { return (DateTime?)ViewState\["Birthday"\] ?? DateTime.Now; } set { ViewState\["Birthday"\] = value; } } protected override int CreateChildControls(IEnumerable pDataSource, bool pBinding) { base.CreateChildControls(); Label vLabel = new Label(); vLabel.Text = Prompt; vLabel.ForeColor = Color.Red; this.Controls.Add(vLabel); Literal vLiteral = new Literal(); vLiteral.Text = ": "; this.Controls.Add(vLiteral); TextBox vTextBox = new TextBox(); vTextBox.ID = "TextBox1"; vTextBox.Text = Birthday.ToString(); this.Controls.Add(vTextBox); return 0; } }
}
It's an extremely simple control, and builds without error. Here is the page that consumes it:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="WebControlDesigner" Namespace="WebControlDesigner" TagPrefix="wcd" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<wcd:ControlWithTasks ID="ControlWithTasks1" runat="server">
</wcd:ControlWithTasks>
</div>
</form>
</body>
</html>It renders perfectly and display the designer menu correctly but if I create a data source or try to select a existing one
it crashes VS2008.
:omg: :confused: What is missing? Please!! I need some help.