custom server control: problem with designer

Discussion in 'ASP .Net Web Controls' started by Jürgen Müller, Aug 30, 2006.

  1. Hi, all.

    I'm having a strange problem while writing custom server control.
    The control works fine so far, but I wanted to add some features which
    support the developer while using the control in the Visual Studio designer.
    Therefore I've added a designer which extends ContainerControlDesigner...see
    code fragment below.

    Problem:
    Sometimes the cast MyComponent c = (MyComponent)base.Component will throw an
    exception - and sometimes not. I haven't found a reason for this. The type of
    base.Component is MyComponent. I've checked this in the debugger. Even Visual
    Studio shows me all properties of this type during debugging.
    I've modified the code and read the value of c.MyProperty via reflection -
    and it works...

    Any ideas what might be wrong or what happens here?

    Any help appreciated.

    Reagrds
    Jürgen
    Code fragment:

    public class MyDesigner : ContainerControlDesigner
    {

    public override string FrameCaption {
    get
    {
    MyComponent c = (MyComponent)base.Component;

    return "MyComponent - " + c.MyProperty;
    }

    }
    Jürgen Müller, Aug 30, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve B.
    Replies:
    4
    Views:
    946
    Cheryl D Wise
    Jun 1, 2007
  2. Don
    Replies:
    1
    Views:
    152
    Andrew Backer
    Jul 19, 2005
  3. Alexander Higgins
    Replies:
    3
    Views:
    1,064
    Teemu Keiski
    Jul 30, 2007
  4. Don
    Replies:
    1
    Views:
    177
    Andrew Backer
    Jul 19, 2005
  5. Alexander Higgins
    Replies:
    0
    Views:
    436
    Alexander Higgins
    Jul 21, 2007
Loading...

Share This Page