Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. CompositeDataBoundControl designer crashes VS2008

CompositeDataBoundControl designer crashes VS2008

Scheduled Pinned Locked Moved C#
csharphelpquestionhtmlvisual-studio
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andre Vianna
    wrote on last edited by
    #1

    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 = ":&nbsp;";
    		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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups