Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem refreshing after NEW clicked
Message
 
À
23/10/2003 14:49:22
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00841145
Message ID:
00842552
Vues:
23
Terry,

>My question stated another way. Is there behavior in the NEW button or methods it calls, to REFRESH the form with the newly added row? After clicking the NEW button I have checked and there is a blank row added to the dataset table ‘CLIENT’ but the previous row( with data ) is still visible on the form. Is there default behavior in the button to refresh the form's bound controls? Do I have to add code to clear bindings and re-bind to the blank row?

Based on the fact that you're getting a new record in the DataSet, the New button is functioning properly. The issue here is Windows Forms unintuitive data binding model!

To display the new row, you need to tell the form's <>BindingContext <>object to position to the new row. For example:

In C#:
this.BindingContext[this.oOrder.GetCurrentDataSet(), "Orders"].Position = 
				this.oOrder.GetCurrentDataSet().Tables["Orders"].Rows.Count -1;
And in VB .NET:
Me.BindingContext(Me.oOrder.GetCurrentDataSet(), "Orders").Position = Me.oOrder.GetCurrentDataSet().Tables("Orders").Rows.Count - 1
This code passes a reference to a business object's DataSet, and DataTable name, and sets the position to the last row in the DataSet (Rows.Count -1) within the BindingContext object.

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