Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2008, 04:00 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default Custom Controls and Styling

Hi All,

I am developing some custom ASP.NET controls to handle some of the boilerplate UI elements we want across the range of our applications, part of the requirements for this is of course full styling/theme support.

So I began looking into how to do this, and I have to be honest, I could use some help!

My current implementation is that all the major elements have a string property where you can enter the CSS that you want applied to that item into the designer, and if present, it is rendered within the 'style' attribute of the HTML. This works fine and offers a great deal of flexiblity and control.

My may question is, "is there a better way?" :)

I know the default controls use a style object somehow, although I have not really had the time to investigate how this works fully at this point :( Would be nice to include though, since you would then get to use the Style builder from the designer right?

Any, and all help greatly appreciated. :)

Thank you.

Rob
http://cantgrokwontgrok.blogspot.com
__________________
Rob
http://cantgrokwontgrok.blogspot.com
 
Old July 4th, 2008, 01:08 AM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

hi
from what i understood from your reply, theming and skin will be appropriate for your requirement. create a theme or skin depends on your requirement. then use this theme in the page or control level. If you prefer to use skins then you may specify the skin id for controls

Pon Saravanan
http://www.vbknowledgebase.com
 
Old July 4th, 2008, 02:06 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Pon,

Thanks for the reply, although my question was not really questioning the use of themes/skins, but rather the design I have used to apply styles to the custmo control (i.e. string properties that sets the "style" attribute at run time - is there another/better way at the coding level to apply styles?

Thanks again,
Rob

Rob
http://cantgrokwontgrok.blogspot.com
 
Old July 6th, 2008, 07:56 AM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You may need to make use CssClass property for the control to get rid of style. May be it is an additional head ache at the start but it is a scalable and reusable way of applying style to a control

If you want me to highlight how to use CSSClass(create style sheet .css file and referring the created style class to control). Please let me know. I will explain to you in detail.

By the way if you are using CSS then dynamically changing the css class can be done by theme and skin. That why I had highlighted in my last posting.

Hope now it is clear. If not please elaborate in detail


Pon Saravanan
http://www.vbknowledgebase.com
 
Old July 8th, 2008, 05:39 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Pon,

Apologies for my delay in replying. I have been working hard to try and get this control done because it has taken me so long to get my head around some of the concepts. I have discovered how to use a Style property (so you get to use the design time "style designer" support) which is great - albeit a bit archaeic in that you need to examine each of the styles properies and apply it (unless of course you are using a constituent control which has an ApplyStyle method).

I have not yet had the opportunity to investigate the use of CSS class, but I am assuming that when you render the control, you simply render with the 'class' attribute and reference to the string given?

Again, apologies for the delay and thank you for the response.

Rob
http://cantgrokwontgrok.blogspot.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Controls kcis8rm ASP.NET 2.0 Basics 2 July 2nd, 2007 04:07 PM
Custom Controls bmains ASP.NET 1.x and 2.0 Application Design 1 April 8th, 2004 05:26 PM
Custom Controls bmains VS.NET 2002/2003 3 February 5th, 2004 09:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.