Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Problems creating a Designer

Reply
Thread Tools

Problems creating a Designer

 
 
Kjetil Nordahl
Guest
Posts: n/a
 
      11-09-2004
In designview of the WebForm, my control shows the error message: "Error
Creating Control - ReportDate1 (i)".

Failed to create designer
'System.Windows.Forms.Design.ComponentDocumentDesi gner,
System.Design, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'

What is wrong?
The webcontrol is working, but I would like the designer to work too...
 
Reply With Quote
 
 
 
 
Kjetil Nordahl
Guest
Posts: n/a
 
      11-12-2004
Ok. I think I found the problem. It works now, anyway!

The problem was in the [Designer()] on the control-class.
the string-parameter to Designer should be:

[Designer("namespace-name.designerclass-name, assembly-name")]

 
Reply With Quote
 
 
 
 
Kurt Yokum
Guest
Posts: n/a
 
      11-12-2004
Could use drop in a code sample that includes this Designer syntax? I am not
familiar with where this would go in the code.

Thanks,
Kurt

"Kjetil Nordahl" wrote:

> Ok. I think I found the problem. It works now, anyway!
>
> The problem was in the [Designer()] on the control-class.
> the string-parameter to Designer should be:
>
> [Designer("namespace-name.designerclass-name, assembly-name")]
>

 
Reply With Quote
 
Kjetil Nordahl
Guest
Posts: n/a
 
      11-15-2004
Here is an example on a webcontrol with a designer. This designer should show
a dropdownlist with the item "design-time item".

using System;
using System.ComponentModel;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;

namespace MyCompany.MyControls
{
[ToolboxData("<{0}:MyWebControl runat=server></{0}:MyWebControl>"),
Designer("MyCompany.MyControls.MyWebControlDesigne r, MyWebControl")]
public class MyWebControl : WebControl
{
....
}

public class MyWebControlDesigner : ControlDesigner
{
public override string GetDesignTimeHtml()
{
MyWebControl ctrl = (MyWebControl)Component;

// create the html-writer
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);

// add a control that you want to show at design-time
DropDownList designTimeDropDownList = new DropDownList();
designTimeDropDownList.Items.Add("design-time item");

// get design-time styles and formatting from your control
MyWebControl ctrl = (MyWebControl)Component;
designTimeDropDownList.CssClass = ctrl.CssClass;

// let the design-time control render itself on the html-writer
designTimeDropDownList.RenderControl(tw);

// return the html-code from the html-writer
return sw.ToString();
}
}
}

Also add the following code to the AssemblyInfo.cs-file to get a nice
tag-prefix (<abc:MyWebControl runat="server" />)

using System.Web.UI;
[assembly: TagPrefix("MyCompany.MyControls", "abc")]


"Kurt Yokum" wrote:

> Could use drop in a code sample that includes this Designer syntax? I am not
> familiar with where this would go in the code.
>
> Thanks,
> Kurt
>
> "Kjetil Nordahl" wrote:
>
> > Ok. I think I found the problem. It works now, anyway!
> >
> > The problem was in the [Designer()] on the control-class.
> > the string-parameter to Designer should be:
> >
> > [Designer("namespace-name.designerclass-name, assembly-name")]
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Designer Property Serialization -- Sycning inner properties to designer property window Alexander Higgins ASP .Net Building Controls 3 07-30-2007 09:09 PM
Designer Property Serialization -- Sycning inner properties to designer property window Alexander Higgins ASP .Net Web Controls 0 07-21-2007 12:58 AM
Sharepoint Designer/ Expression Web Designer : adding item in toolbox ? Steve B. ASP .Net 4 06-01-2007 04:29 AM
Custom web control problems in the designer pane (simple examples) Dales ASP .Net 18 12-03-2003 11:25 PM
HTML Designer Problems Lloyd Sheen ASP .Net 17 11-21-2003 01:36 PM



Advertisments