Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:12 PM.


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