Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Clever ways to work around the fact that control breaks VS.NET design view? (replacing a literal?)

Reply
Thread Tools

Clever ways to work around the fact that control breaks VS.NET design view? (replacing a literal?)

 
 
Ken Fine
Guest
Posts: n/a
 
      08-26-2007
I'm using ASP.NET and VS.NET 2008 beta. (This is not specifically a VS.NET
beta question -- it IS an ASP.NET Q -- so please keep reading.)

Scott M. made a very nice control to dynamically generate rounded corners:
http://datawebcontrols.com/demos/RoundedCorners.aspx

This control functions with the design view in VS.NET 2005 but appears to
break in the design view in VS.NET 2008. Explanation: Scott's control can
"wrap" other content, and in VS.NET the content inside the rounded corner
control is hidden. Nontheless, the control works fine when rendered.

I am wondering what clever ways I might be able to use to retain my design
view in VS.NET 2008 while still calling Scott's code at runtime. I am sure
there is a way. I list some options shortly.

In ASPX it is called like this:

<cc1:RoundedCorners ID="Roundedcorners3" ShowTitle="False" Title="Test"
runat="server BackColor="#FFFFFF" BorderColor="Gold" BorderStyle="Solid"
BorderWidth="3px"
Font-Names="Verdana"
ImageDirectory="~/RoundedCornersTester/Images/" Font-Size="11px"
Width="100%" Padding="2px"
HorizontalAlign="Right" TitleStyle-BackColor="#C0C0FF"
CornerHeight="15px"
BackgroundBackColor="#3A265A" align="Right" >

[ whatever content you want inside the rounded corner control goes here ]

</cc1:RoundedCorners>

So I am familiar with the notion of dynamically calling controls from
codebehind, but I don't think that works here since you are "wrapping" other
controls and content.

Some options I see include:
1) Somehow specifying comment characters in the declarative ASPX, and
programmatically removing those comment characters at runtime. Right now I'm
manually inserting comment characters in the markup and removing them by
hand when I deploy.

2) Somehow injecting the entire block of declarative ASPX programmatically
at runtime, but prior to the time the aspx markup is parsed and rendered. I
don't even know if this is possible: I'm interested if it is. We would need
to programmatically inject the opening tag and the closing tag. Based on
other examples I've read involving a mysterious something called a
"literal", I think this may be possible.

3) Something else cleaner that I'm not quite fathoming.

Any help out there in net land?

Thank you,
-KF

 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-27-2007
Hi Ken,

I've downloaded the control as you mentioned and loaded into VS2008 Beta 2.
I can see the control was origionally written for VS2003, therefore it's
using some obsolete class such as the custom control designer.

Actually if remove the custom control designer and replace it with the
suggested ContainerControlDesigner:

[DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
Designer(typeof(ContainerControlDesigner))]
public class RoundedCorners : System.Web.UI.WebControls.WebControl



It should work correctly in design time.


Hope this helps.



Regards,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      08-27-2007
"Ken Fine" <> wrote in message
news:816C5272-24E0-4E16-B7EC-...

> Scott M. made a very nice control to dynamically generate rounded corners:
> http://datawebcontrols.com/demos/RoundedCorners.aspx


I made the most recent changes to this control, specifically updates for
ASP.NET 2 and XHTML-compliance...

I must admit I've not tried it in Orcas yet. However, the download from the
4GuysFromRolla site
(http://aspnet.4guysfromrolla.com/cod...dedCorners.zip) includes the full
source code for the control, so feel free to experiment with it...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Ken Fine
Guest
Posts: n/a
 
      08-27-2007
Hi Walter,

Thank you very much for the investigation: it's above and beyond the call.
Can you tell me how you "remove the custom control designer and replace it
with the suggested ContainerControlDesigner"? Where in code (or in the tool)
do you make that change?

Thanks again,
-KF


""Walter Wang [MSFT]"" <> wrote in message
news:...
> Hi Ken,
>
> I've downloaded the control as you mentioned and loaded into VS2008 Beta
> 2.
> I can see the control was origionally written for VS2003, therefore it's
> using some obsolete class such as the custom control designer.
>
> Actually if remove the custom control designer and replace it with the
> suggested ContainerControlDesigner:
>
> [DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
> ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
> Designer(typeof(ContainerControlDesigner))]
> public class RoundedCorners : System.Web.UI.WebControls.WebControl
>
>
>
> It should work correctly in design time.
>
>
> Hope this helps.
>
>
>
> Regards,
> Walter Wang (, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>


 
Reply With Quote
 
Ken Fine
Guest
Posts: n/a
 
      08-27-2007
The control is very good and very useful. Nice work on it, Mark!

-KF

"Mark Rae [MVP]" <> wrote in message
news:...
> "Ken Fine" <> wrote in message
> news:816C5272-24E0-4E16-B7EC-...
>
>> Scott M. made a very nice control to dynamically generate rounded
>> corners: http://datawebcontrols.com/demos/RoundedCorners.aspx

>
> I made the most recent changes to this control, specifically updates for
> ASP.NET 2 and XHTML-compliance...
>
> I must admit I've not tried it in Orcas yet. However, the download from
> the 4GuysFromRolla site
> (http://aspnet.4guysfromrolla.com/cod...dedCorners.zip) includes the
> full source code for the control, so feel free to experiment with it...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-28-2007
Hi Ken,

If you open the file RoundedCornersDesign.cs in VS2005 or 2008, the IDE
should notify you that the ReadWriteControlDesigner is now obsolete and you
should use ContainerControlDesigner instead.

Now, open the file RoundedCorners.cs, change:

[DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
Designer(typeof(PrettyUI.Design.RoundedCornersDesi gn))]
public class RoundedCorners : System.Web.UI.WebControls.WebControl
{

into:


[DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
Designer(typeof(System.Web.UI.Design.ContainerCont rolDesigner))]
public class RoundedCorners : System.Web.UI.WebControls.WebControl
{


You should see it works in VS2008. Let me know if you still have trouble to
make it work.


Regards,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Ken Fine
Guest
Posts: n/a
 
      08-29-2007
Thanks again Walter. As always you are extremely helpful.

Best,
-KF


""Walter Wang [MSFT]"" <> wrote in message
news:...
> Hi Ken,
>
> If you open the file RoundedCornersDesign.cs in VS2005 or 2008, the IDE
> should notify you that the ReadWriteControlDesigner is now obsolete and
> you
> should use ContainerControlDesigner instead.
>
> Now, open the file RoundedCorners.cs, change:
>
> [DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
> ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
> Designer(typeof(PrettyUI.Design.RoundedCornersDesi gn))]
> public class RoundedCorners : System.Web.UI.WebControls.WebControl
> {
>
> into:
>
>
> [DefaultProperty("Text"), PersistChildren(true), ParseChildren(false),
> ToolboxData("<{0}:RoundedCorners runat=server></{0}:RoundedCorners>"),
> Designer(typeof(System.Web.UI.Design.ContainerCont rolDesigner))]
> public class RoundedCorners : System.Web.UI.WebControls.WebControl
> {
>
>
> You should see it works in VS2008. Let me know if you still have trouble
> to
> make it work.
>
>
> Regards,
> Walter Wang (, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>


 
Reply With Quote
 
Ken Fine
Guest
Posts: n/a
 
      08-29-2007
Thanks. This works great now (albeit with a small bit of display funkiness
that is doubtless VS.NET 2008's issue.)

For any other newbs trying to get this going, here's whatcha gotta do:
a) add a project to your solution for a "Server Control"
b) Right-click on "References" and be sure to add "System.Design" to the
reference list
c) Sub in Walter's code
d) You must allow unsafe code in compilation. Right click on the project you
made for the server control, go to "build", and choose the "unsafe code"
option
e) I compiled for .NET 3.5 and all seems well.

Appreciate the help.

-KF
"Ken Fine" <> wrote in message
news:816C5272-24E0-4E16-B7EC-...
> I'm using ASP.NET and VS.NET 2008 beta. (This is not specifically a VS.NET
> beta question -- it IS an ASP.NET Q -- so please keep reading.)
>
> Scott M. made a very nice control to dynamically generate rounded corners:
> http://datawebcontrols.com/demos/RoundedCorners.aspx
>
> This control functions with the design view in VS.NET 2005 but appears to
> break in the design view in VS.NET 2008. Explanation: Scott's control can
> "wrap" other content, and in VS.NET the content inside the rounded corner
> control is hidden. Nontheless, the control works fine when rendered.
>
> I am wondering what clever ways I might be able to use to retain my design
> view in VS.NET 2008 while still calling Scott's code at runtime. I am sure
> there is a way. I list some options shortly.
>
> In ASPX it is called like this:
>
> <cc1:RoundedCorners ID="Roundedcorners3" ShowTitle="False" Title="Test"
> runat="server BackColor="#FFFFFF" BorderColor="Gold" BorderStyle="Solid"
> BorderWidth="3px"
> Font-Names="Verdana"
> ImageDirectory="~/RoundedCornersTester/Images/" Font-Size="11px"
> Width="100%" Padding="2px"
> HorizontalAlign="Right" TitleStyle-BackColor="#C0C0FF"
> CornerHeight="15px"
> BackgroundBackColor="#3A265A" align="Right" >
>
> [ whatever content you want inside the rounded corner control goes here ]
>
> </cc1:RoundedCorners>
>
> So I am familiar with the notion of dynamically calling controls from
> codebehind, but I don't think that works here since you are "wrapping"
> other controls and content.
>
> Some options I see include:
> 1) Somehow specifying comment characters in the declarative ASPX, and
> programmatically removing those comment characters at runtime. Right now
> I'm manually inserting comment characters in the markup and removing them
> by hand when I deploy.
>
> 2) Somehow injecting the entire block of declarative ASPX programmatically
> at runtime, but prior to the time the aspx markup is parsed and rendered.
> I don't even know if this is possible: I'm interested if it is. We would
> need to programmatically inject the opening tag and the closing tag. Based
> on other examples I've read involving a mysterious something called a
> "literal", I think this may be possible.
>
> 3) Something else cleaner that I'm not quite fathoming.
>
> Any help out there in net land?
>
> Thank you,
> -KF
>


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-29-2007
Hi Ken,

I'm glad that helped.

By the way, have you changed your nospam posting alias recently? Could you
please tell me your previous posting alias? Thanks.

Regards,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Long integers and ways around xrange Martin Manns Python 2 01-16-2010 09:59 PM
PIX VPN client-to-client routing: clever ways? Jay Levitt Cisco 1 01-21-2006 06:36 AM
Read all of this to understand how it works. then check around on otherRead all of this to understand how it works. then check around on other thelisa martin Computer Support 2 08-18-2005 06:40 AM
Clever / safe ways to carry digicam batteries in pocket Veggie Digital Photography 13 06-24-2004 02:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57