473,396 Members | 1,879 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,396 software developers and data experts.

Using databinding to display settings

I was thinking about using databinding to display the user settings.
I'm not using the .NET 2.0 ApplicationSettings but I'm using a class
that contains all the settings.

I have a few questions:

1. What's the best practice to store settings? I like using my own
class as I can choose how to serialize and store the data
2. How do I validate the inserted data? Should the validation logic be
handled by the UI or the underlying business logic
3. I don't think I can revert the changes using a business object, so
my idea is to create a copy of the original settings object and
overwrite it if the user confirms the operation.

Thanks a lot.
Andrea
Dec 30 '07 #1
3 1388
1. What's the best practice to store settings? I like using my own
class as I can choose how to serialize and store the data
If the purpose is similar to ApplicationSettings, I'd use
ApplicationSettings - simply as a time saver.
2. How do I validate the inserted data? Should the validation logic be
handled by the UI or the underlying business logic
An interesting one; obviously if you use ApplicationSettings you can't
do the latter, so it would have to be the former - but the latter is
generally preferable. If you *did* have your own class, then this
could be by exceptions from the property setters (which your UI must
handle) - or it could be via IDataErrorInfo (which some bindings [esp.
grids] will display automatically).
3. I don't think I can revert the changes using a business object, so
my idea is to create a copy of the original settings object and
overwrite it if the user confirms the operation.
Actually, some overly complex things are possible using
TransactionScopes ;-p But don't go there!
Yes - when using databinding, the object is generally updated quite
early, making it a pain to press Cancel. One option is to set the
Binding's DataSourceUpdateMode to Never and do it manually (when OK is
clicked) by using WriteValue().
Alternatively, look into the memento pattern, or take a snapshot using
either ICloneable or serialization; note the ICloneable is less
reliable as it is ambiguous over deep/shallow clone (serialization
will either be deep or will fail).

Marc

3. I don't think I can revert the changes using a business object, so
my idea is to create a copy of the original settings object and
overwrite it if the user confirms the operation.

Thanks a lot.
Andrea
Dec 30 '07 #2
Hello Andrea,

Would you mind letting me know the result of the suggestions from Marc ? If
you need further assistance, feel free to let me know. I will be more than
happy to be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, 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.

Jan 4 '08 #3
Thanks for the suggestions. I'm using a cloned object to store
settings temporarily and copy that upon the user pressing OK.

On Fri, 04 Jan 2008 02:56:46 GMT, ji****@online.microsoft.com
(Jialiang Ge [MSFT]) wrote:
>Hello Andrea,

Would you mind letting me know the result of the suggestions from Marc ? If
you need further assistance, feel free to let me know. I will be more than
happy to be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, 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.
Jan 5 '08 #4

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

Similar topics

1
by: GMG | last post by:
By providing a DTD in an XML document which is bound to HTML controls, Internet Explorer will automatically format the display of the date fields. For example 2004-08-03T00:00:00 will be displayed...
7
by: Tarren | last post by:
Hi: I am pulling duration out of my DB and it returns duration in seconds. For the display i would like to show it in time format with colon So duration of 221 I want it to display 03:41 ...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
2
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: ...
7
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about...
2
by: MrCrool | last post by:
Hi I need to be able to handle the following ASP programming in pure C# code: <asp:TemplateColumn HeaderText="Customer Information"> <ItemTemplate> <table border="0"> <tr> <td...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
3
by: Jason Wolf | last post by:
I have added application settings for a few user options such as ShowFramerate. I have a toolstrip with menu checkable menu items and have bound their checked property to the relevant...
44
by: John Dann | last post by:
I'm unclear as to how best to use what I'm terming the top-level CSS selectors, by which I mean selectors like *, html and body. I'm coming at this from trying to understand how best to set font...
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: 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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...

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.