Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2004, 10:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Design-Time Debugging

Hello,

Does anybody know how to debug an ASP.NET control at design-time? The control also implements a custom designer.

Brian
__________________
Brian
 
Old October 18th, 2004, 11:57 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Brian,

Take a look at this NSFAQ (not so frequently asked question ;)): http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=306

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 18th, 2004, 02:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Thanks. For some reason though, my control isn't triggering the designer functionality (GetDesignTimeHtml and GetEmptyDesignHtml) methods. I have breakpoints at those methods, and nothing is being returned. It isn't showing up in the IDE designer correctly, and I thought it may be the designer class.

Have you experienced this? Thanks,

Brian
 
Old October 18th, 2004, 03:46 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hmmm, no, not that I recall. I am sure you already checked this, but is your solution configuration for the control set to Debug?


Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 19th, 2004, 06:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Yes, debugging works to a point because I can debug properties when I change the value.

My declaration for the control is:

<DefaultProperty("Text"), DefaultEvent("CheckChanged"), Designer(GetType(Design.MyLinkButtonDesigner), GetType(System.Web.UI.Design.ControlDesigner))> _
Public Class MyLinkButton
 Inherits WebControl

And the designer:

Public Class MyLinkButtonDesigner
 Inherits System.Web.UI.Design.ControlDesigner

At what point do these methods get called? I would imagine that they would get called as soon as the control is dragged/dropped onto the page.

Also, is it possible to debug this from two separate solutions, as I did have them in the same solution, but broke them out.

Brian
 
Old October 19th, 2004, 02:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's been a while since I created server controls, so I am not sure what behavior you can expect.
However, I just did a quick test with a control I built a while ago with debugging support, but it no longer breaks into the code when I add a control to the page.

I get a "this breakpoint will currently not be hit" message. This control is a bit odd as I made some change recently that force me to compile the control with a command line compiler, and no longer with Visual Studio .NET (I added support for embedded resources), so maybe that's confusing VS.NET now. But it's still very strange.

Will test it out later this week, see if I can get it working again....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 19th, 2004, 03:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I just did a very simple test, and I got it to work.

Here's what I did:

1. Create a very simple control. I had something like this:
Code:
  [
  DefaultProperty("ScaleLegend"),
  ToolboxData("<{0}:Rating runat='server'></{0}:Rating>"),
  Designer(typeof(Spaanjaars.Toolkit.Designers.DisplayContentRatingDesigner))
  ]
  public class Rating : WebControl, INamingContainer 
  {
    public Rating()
    {
      string test = System.DateTime.Now.ToString();
    }
    // More code here
  }
  Next, I created the simplest designer possible:
Code:
namespace Spaanjaars.Toolkit.Designers
Code:
{
  internal sealed class DisplayContentRatingDesigner : System.Web.UI.Design.ControlDesigner
  {
    public override string GetDesignTimeHtml()
    {
      return "<strong>I am a test test</strong>";
    }
  }
}
I set a break point on the first (and only) line of the Rating constructor and on the return statement in the GetDesignTimeHtml method.

Next, I started debugging as per my FAQ, and everything worked perfectly. Both breakpoints were hit.

If I were you I'd try a very simple control, and get it to work. Then put back in your complexer controls and try to figure out where it breaks. It just has to work....

Re: multiple projects: I think that should be possible, but haven't tested it. Instead of setting devenv as the program to start, you'll need to manually attached the devenv process running the web app to your control. You can use debug | Processes to attach to it. I tested it with one devenv and it seemed to work, so there's a fair chance you can hook it up to a second as well.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Micro cuts by Muse (Track 7 from the album: Origin of symmetry) What's This?
 
Old October 20th, 2004, 07:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Thanks, I'll try that.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Design-Time Debugging of ASP.NET Custom Controls robzyc ASP.NET 2.0 Basics 0 July 2nd, 2008 06:29 AM
Resizing in Design Time Farside Visual Studio 2005 1 August 9th, 2007 06:42 PM
Design Time Exception in WinForm doctorwcc VB.NET 0 March 2nd, 2007 04:00 AM
xxx_Init( ... ) design-time method? bradnerdhss BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 August 8th, 2006 06:52 PM
Design-Time or Run-Time now ? ALGNET .NET Framework 2.0 1 July 31st, 2006 04:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.