Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web Control Binding and Session Questions
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00789337
Message ID:
00789533
Vues:
20
Bill,

Good to see you here!

First of all, are you using Beta 10? I've made some significant changes in Web Forms and data binding in this version.

>1. In a web form, I'd like to allow a "Cancel" or "Reload" button that posts back and reloads the current record onto the form. I've walked through the binding code and the only time that I see "BindControlToData" being called is when the form isn't being posted back. So if I want to reload the record, or if I am navigating somehow on the web form, I can't get the controls to show the values of the new record. I must be missing something. ??? I can redirect to the form, passing info through the session state or via form fields, but I'd love to see more implementation of the state changes to cause the controls to rebind to new data during post back if needed.

In beta 10, if a control's BindingType is set to OneWay or TwoWay it should bind whenever you retrieve data in the BindingSource business object...regardless of the value of IsPostBack.

>2. The example in the docs stores the dataset on the session. I may not understand this well enough. In walking through the UML and the code, it looks like on post back, controls set for TwoWay binding will update their values back into the dataset so we may then save that dataset with the business object. Is this just an example, or a best practice? The session can expire. We would then loose the dataset used for the update. Or... If the user opens two browser sessions, they share the same session.. is this correct? So if my user opens say, "Customer Maintenance" twice and is working on 2 different customers, when the user saves the first customer, the dataset from the second one (on the session) will be used and the data will be overwritten by the bound web controls during postback. If I save it, I've trashed a record. I know I must not understand this. Please correct me...

The example presents a simple way of persisting data. You're right that persisting to the session object could be a problem if the user sits on their hands and the session expires. With ASP.NET saving the session is a much more viable option than in ASP since you can specify that session state is stored in other places such as SQL Server. Given this option you could further extend the session length knowing that it's persisted in the database. Alternately, you can simply choose to persist the DataSet in SQL Server manually. Long story short, you can choose to persist and retrieve the DataSet any way you like.

>3. It appears we are retrieving the schema information in the dataset by default. Could we use that information to set the MaxLength property in the mmTextBox during binding? I wrote a framework for Windows forms in .NET and this feature is extremely helpful.

Funny you should ask...this is in the works for the next beta.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform