Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Help With Designer for a Control

Reply
Thread Tools

Help With Designer for a Control

 
 
paul reed
Guest
Posts: n/a
 
      02-09-2004
Hi,

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
planned.

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.

Regards,

Paul


 
Reply With Quote
 
 
 
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      02-10-2004

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, VS.net 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, VS.net 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:

[Designer(typeof(mycontroldesigner),
typeof(System.ComponentModel.Design.IDesigner))]
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
information:
http://www.wdvl.com/Authoring/ASP/NE...sp_net3_2.html

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

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! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
 
Paul Reed
Guest
Posts: n/a
 
      02-11-2004
Jeffrey,

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
www.jacksonreed.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      02-12-2004

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! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
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
How do I get a custom Control Designer to write to the HTML of my control? Don ASP .Net Web Controls 1 07-18-2005 11:16 PM
How do I get a custom Control Designer to write to the HTML of my control? Don ASP .Net Building Controls 1 07-18-2005 11:16 PM



Advertisments