473,813 Members | 3,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1540

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*********@bl uewin.chwrote in message
news:O1******** ******@TK2MSFTN GP03.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
9469
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
21
2107
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 string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value Terry,Burns.
4
4200
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 and without loosing viewstate etc etc. How can this be done? What is best practice? I guess the answer for my question lies in how I design/develop the tab
4
2477
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 using ASP.Net and ADO.Net. In your experience does it make more sense to allow NULL values for VARCHAR fields or will they behave well and get set to zero length strings when a user doesn't fill in a text field? I'm wondering if I should do:
2
1684
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 best way of setting it up for ease of updates. This is completely beyond anything I've tried before so if people have better suggestions on how to do things, feel free. What I am currently considering is splitting the database, with a password...
8
3931
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
4399
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 my class, the values do not update the settings file. Can anyone provide any insight and/or sample code on how to use a user defined class as a valid and usable type in the settings.settings file? Thanks, --Rob.
1
1582
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 creating, it would be nice to use a DispatchTimer to "ramp up" a value, depending on how long the mouse is held down. Thanks,
4
2499
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 unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
9607
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10667
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10422
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10139
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9222
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5568
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.