473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Custom controls settings, best practice question

Hi,

I like to develop custom controls for a number of webpages. These
controls are often customizable, so that they can be reused in a number
of situations.

My question is: What is the best practice for configuring a custom
control. As far as I can say, I have the following alternatives:

- Defining properties for the control, and setting these in the ASPX
page where the control is included (this is what I do now). This has the
advantage that the settings are defined in the same file as the control
itelf, only one file to manage. However, when there are many settings,
one might lose the overview. Also, these properties are parsed on every
roundtrip, so it's not really efficient.

- Using a settings section in web.config. This has the advantage that
settings are not parsed on every roundtrip.

- A mix of these two solutions.

What are your thoughts?

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 26 '06 #1
2 1521

If the setting are "set 1 time" for the majority of cases..
then I'd go with a custom configuration section/custom handler.

If the property(ies) are going to change for each page that has an
instance(s) of your control, use a property, and set it on the page_load.

If your "set 1 time" is the case most of the time, then use the custom
config section, but add a property so a specific page (using your control)
can override the default setting.

.....

Once you get used to (and getting past your first one) .. to using custom
config sections... you'll end up liking them I think.

spaces.msn.com/sholliday/

check my smtp configuration tool, I have a custom config section/handler
written there.

make sure you put a break point on the handler itself (.Create method?) so
you can see it parsing the xml to create the concrete objects.

...

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:O1**************@TK2MSFTNGP03.phx.gbl...
Hi,

I like to develop custom controls for a number of webpages. These
controls are often customizable, so that they can be reused in a number
of situations.

My question is: What is the best practice for configuring a custom
control. As far as I can say, I have the following alternatives:

- Defining properties for the control, and setting these in the ASPX
page where the control is included (this is what I do now). This has the
advantage that the settings are defined in the same file as the control
itelf, only one file to manage. However, when there are many settings,
one might lose the overview. Also, these properties are parsed on every
roundtrip, so it's not really efficient.

- Using a settings section in web.config. This has the advantage that
settings are not parsed on every roundtrip.

- A mix of these two solutions.

What are your thoughts?

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Aug 26 '06 #2
Hi,

sloan wrote:
If the setting are "set 1 time" for the majority of cases..
then I'd go with a custom configuration section/custom handler.
Yes.

If the property(ies) are going to change for each page that has an
instance(s) of your control, use a property, and set it on the page_load.
That's what I currently do.

If your "set 1 time" is the case most of the time, then use the custom
config section, but add a property so a specific page (using your control)
can override the default setting.
I will have properties anyway, because of the flexibility they offer.
Once you get used to (and getting past your first one) .. to using custom
config sections... you'll end up liking them I think.
I know how to do config sections, I use them already for other purposes
(Page). My question was related to custom controls specifically. What I
like in my current solution is that the custom control's definition is
in one place only, and that's the ASPX page, but I am not against your
suggestions at all.

Thanks for your input!

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
21
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a...
4
by: Marius Trælnes | last post by:
Hello! I am about to make a class/control that creates tabbing functionality. The result is in HTML/CSS/JavaScript output. My question is: Within the tabs I want to simply add user controls...
4
by: Randall Parker | last post by:
I am designing a database schema. It happens to be in MySQL but I'm trying to keep it portable to other databases should the project grow. Anyway, suppose you have VARCHAR fields and will be...
2
by: Regnab | last post by:
I'm creating a database that will be used independently at different sites (in the same company). Given the fact that there will be inevitable changes down the track, I'm trying to work out the...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
3
by: =?Utf-8?B?Um9iIEw=?= | last post by:
I am trying to use a custom type inside settings.settings. When I create my class, I am able to add it in as the type and the value ends up showing as XML data. If I change any of the values in...
1
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hello All-- Just a general (or perhaps loaded) question - is it considered good or bad practice to use code-behind with a CustomControl.generic.xaml file? For instance, with a control I'm...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.