Scott on Writing

Musings on technical writing...

As Promised, the Article on the RoundedCorners Web Control

In my last blog entry I mentioned how I had created a Web control that displays a box with rounded corners, using GDI+ to dynamically create the corner images based on the box's properties (background color, border color/style/width, etc.).  I have just published an article on 4Guys about this Web control - Introducing the RoundedCorners Web Control - including the complete source code for the control.  There are a couple of minor issues with the control that I hope others will be able to improve upon:

  1. The design-time experience is suboptimal, as the rounded corner images are not created during design-time.  The result is a box sans rounded corners!
  2. The control currently uses an HTML <table>; it'd be nice to have someone upgrade it to use CSS and have adaptively choose what approach to use based on the visiting browser.
  3. As Jeffrey Palermo mentioned in the last blog entry's comments, it would be nice to have smoother corners.

As always, I invite you to check out the live demos and share any feedback/suggestions/comments you may have.  You can also check out my Code Projects page, which lists the open-source ASP.NET Web controls I've created.

posted on Tuesday, July 27, 2004 8:56 PM

Feedback

# re: As Promised, the Article on the RoundedCorners Web Control 7/28/2004 1:13 AM Peter Steen Nielsen

Hej Scott - Certainly looks as a very nice control.

implementing (drag and drop - VS) it however Gives a server error...


Multiple controls with the same ID 'RoundedCorners1' were found. Trace requires that controls have unique IDs.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Multiple controls with the same ID 'RoundedCorners1' were found. Trace requires that controls have unique IDs.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): Multiple controls with the same ID 'RoundedCorners1' were found. Trace requires that controls have unique IDs.]
System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize) +312
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +198
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +260
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +260
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +260
System.Web.UI.Page.ProcessRequestMain() +1599




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Any ideas.. ??

Keep up the good work!

# re: As Promised, the Article on the RoundedCorners Web Control 7/28/2004 3:12 AM Paul Wilson

Very nice article -- but you're always one of the best writers. :) Check out my dynamic button for some more options -- http://www.wilsondotnet.com/Demos/Buttons.aspx.

# re: As Promised, the Article on the RoundedCorners Web Control 7/28/2004 7:27 AM Scott Mitchell

Peter, you get this error when you visit the page through your browser, or when you are adding it to the VS.NET designer? If it's the former, make sure that each RoundedCorner control on your page has a unique ID.

# re: As Promised, the Article on the RoundedCorners Web Control 7/29/2004 10:27 AM Scott Mitchell

Peter, found the problem, and will update the article later today. You can fix this yourself, though, if needed. Basically you need to have the RoundedCorners class implement INamingContainer. That is, in RoundedCorners.cs change line 18 so it reads:

public class RoundedCorners : System.Web.UI.WebControls.WebControl, INamingContainer

# re: As Promised, the Article on the RoundedCorners Web Control 7/29/2004 6:17 PM primortal

i love this control, how can I modifiy the control to remove the 'text' property and and what i would like bewteen the <skm:roundedcorners ...> </skm:roundedcorners>?

I would like to have a datalist output in this control.

thanks

# re: As Promised, the Article on the RoundedCorners Web Control 7/29/2004 6:20 PM Scott Mitchell

Primortal, glad you like the control. Adding the support you're after is on deck. Hope to find time to get it done this weekend.

Thanks!

# re: As Promised, the Article on the RoundedCorners Web Control 8/2/2004 3:58 PM Mads

Nice control. However, it would be nice if an aspx file that showed various usage examples was included in the zip file. Not everyone wants to use Visual Studio.

Ability to put a datagrid / whatever inside as primortal suggested would be great.

# re: As Promised, the Article on the RoundedCorners Web Control 8/4/2004 2:03 PM Marc Krawatsky

Great job, Scott.

Several questions and suggestions...

I wish to create your control programmatically and extract the resultant HTML for use within a custom component. How can we obtain the HTML as a string?

How do we set the TitleStyle property via code-behind? It seems to be readonly.

# re: As Promised, the Article on the RoundedCorners Web Control 8/4/2004 2:11 PM Scott Mitchell

Marc, you should be able to simply call the RenderControl() method, and extract out the rendered HTML. I discuss how to do this in an article that looks at emailing the content of a DataGrid:
http://aspnet.4guysfromrolla.com/articles/091102-1.aspx

hth

# The Bogeyman of ASP.NET 8/5/2004 8:03 AM Dimitri Glazkov

# re: As Promised, the Article on the RoundedCorners Web Control 8/6/2004 6:06 PM bill xie

Scott did an exciting job since I am fasinated with rounded corner style in web page. To make it more useful, I did some <a href=http://site230.webhost4life.com/billxie/demo/TemplateRC.aspx >enhancement</a> to make it a template control. Now text can be any anything you like.

# The Bogeyman of ASP.NET 11/14/2005 11:26 AM Dimitri Glazkov

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles