Help With Designer for a Control

Discussion in 'ASP .Net Building Controls' started by paul reed, Feb 9, 2004.

  1. paul reed

    paul reed Guest


    I have a control that I have built. After Jeffrey on this newsgroup educated
    me about the event lifecycle of CreateChildControls...all is working as

    Now I want to make the control more appealing when it is initially dragged
    from the Toolbar and dropped onto the ASPX page (it is a tree view control
    wrapped inside of a custom control).. Right now, after dropping the control
    onto the design surface, it is a very small control that is almost not
    ledgible. So, I know to make the widget look larger on the surface of the
    page, lets say a rectangle 300px high and 250px wide, I need to provide a
    designer for the control. I would also like to provide a very opaque border
    around it so there is a visual reference to the size (much like what happens
    when you drop a panel control onto a page). I would also like for there to
    be some wording inside of the control just so they know what it is (i.e.,
    ProjectX TreeView Control).

    I built the designer but wasn't sure where to do this at. I tried
    overloading the 'initalize' method and assigning these values but that
    didn't do anything.

    Exactly where should I be doing this in the designer? There are some samples
    out there but they are not very descriptive.


    paul reed, Feb 9, 2004
    1. Advertisements

  2. Hi Paul,

    Thank you for posting in the community!

    I will continue assist you on your further issue :)

    Based on my understanding, you want to customize your web control's
    designtime interface.

    Actually, provides a rich feature support for design-time behavior
    of Web server control.
    You can create a customized control designer for your control.(Inherit
    System.Web.UI.Design.ControlDesigner class)

    In the design time, will invoke ControlDesigner.GetDesignTimeHtml
    method to return the design-time html view for your control. So you should
    override this method and provide your own html view.

    For your reqirement, I think you may use a <div> html tag, make it border
    width and inner html. Like this:

    public class mycontroldesigner: System.Web.UI.Design.ControlDesigner
    public override string GetDesignTimeHtml()
    StringBuilder sb=new StringBuilder();
    sb.Append("<div style=\" BORDER-RIGHT:1px solid; BORDER-TOP: 1px solid;
    BORDER-LEFT:1px solid; BORDER-BOTTOM: 1px solid;WIDTH: 250px; HEIGHT:
    300px\">ProjectX TreeView Control</div>");
    return sb.ToString();

    Use it on your web control like this:

    public class yourwebcontrol

    In the GetDesignTimeHtml method, I returns a <div> tag, whose 4 borders all
    set to 1px solid. Then I set the Width and Height to your wanted value.

    Actually, System.Web.UI.Design.ControlDesigner gives you more design-time
    control over web control, please refer to the article below for more

    Please apply my suggestion above and let me know if it helps resolve your

    Thank you for your patience and cooperation. If you have any questions or
    concerns, please feel free to post it in the group. I am standing by to be
    of assistance.
    Have a nice day!!

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! -
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 10, 2004
    1. Advertisements

  3. Paul Reed

    Paul Reed Guest


    Thanks again (a 3rd time!). Your assistance with my designer worked out
    just fine. Now I am having a problem with my control not resizing for
    some reason. However, I have place that issue in a different post.

    Thanks again Jeffrey. I just received a request to answer a survey on
    the support I have received recently and I gave you high marks!!!

    Paul Reed

    *** Sent via Developersdex ***
    Don't just participate in USENET...get rewarded for it!
    Paul Reed, Feb 11, 2004
  4. Hi Paul,

    Thanks very much for your feedback.

    For your further issue, I will follow up you in that post.

    Also, thanks very much for giving high marks for my support survey! I will
    hold on my work. :)

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! -
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 12, 2004
    1. Advertisements

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.
    Cheryl D Wise
    Jun 1, 2007
  2. Don
    Andrew Backer
    Jul 19, 2005
  3. Alexander Higgins
    Teemu Keiski
    Jul 30, 2007
  4. Don
    Andrew Backer
    Jul 19, 2005
  5. Alexander Higgins
    Alexander Higgins
    Jul 21, 2007

Share This Page