Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem refreshing after NEW clicked
Message
 
To
23/10/2003 14:49:22
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00841145
Message ID:
00842552
Views:
22
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform