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   

My Links

Ads Via DevMavens

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<March 2010>
SMTWTFS
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Comment Stats

DayTotal% of Total
Sunday 2056.8%
Monday 42514.1%
Tuesday 51917.2%
Wednesday 55518.4%
Thursday 58019.2%
Friday 54718.1%
Saturday 1886.2%
Total 3019100.0%

Hour1Total% of Total
12:00 AM 782.6%
1:00 AM 812.7%
2:00 AM 682.3%
3:00 AM 822.7%
4:00 AM 692.3%
5:00 AM 1264.2%
6:00 AM 1183.9%
7:00 AM 1816.0%
8:00 AM 1926.4%
9:00 AM 1585.2%
10:00 AM 1886.2%
11:00 AM 1936.4%
12:00 PM 2016.7%
1:00 PM 1846.1%
2:00 PM 1695.6%
3:00 PM 1354.5%
4:00 PM 1153.8%
5:00 PM 1073.5%
6:00 PM 1013.3%
7:00 PM 1073.5%
8:00 PM 923.0%
9:00 PM 882.9%
10:00 PM 913.0%
11:00 PM 953.1%
Total 3019100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 4.97159
Monday 4.80384
Tuesday 4.04477
Wednesday 7.39680
Thursday 6.26676
Friday 5.07466
Saturday 4.78177
Total 5.403019

Hour1 Entry MadeAvg.Total
12:00 AM 5.2937
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 3.8550
8:00 AM 3.72134
9:00 AM 6.06297
10:00 AM 5.63276
11:00 AM 4.22194
12:00 PM 6.16351
1:00 PM 3.09133
2:00 PM 4.89230
3:00 PM 7.64321
4:00 PM 4.00108
5:00 PM 6.07170
6:00 PM 4.64116
7:00 PM 8.95188
8:00 PM 8.63164
9:00 PM 5.00115
10:00 PM 6.31101
11:00 PM 4.5732
Total 5.403019

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


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles