Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MmButtonNew
Message
De
23/12/2009 11:44:17
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
23/12/2009 11:03:16
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Versions des environnements
Database:
MS SQL Server
Divers
Thread ID:
01440219
Message ID:
01440360
Vues:
42
>It is most definitely the sort order messing things up. I took the sort order out and the New button functioned perfectly.
>
>I haven't looked into the framework source yet, but I was trying to go the route of using the RowAdded event of the grid view:
>
>
>Private Sub dgvSummary_RowsAdded(ByVal sender As System.Object, ByVal e As _
> System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles dgvSummary.RowsAdded
>
> Me.BindingContext(Me.mdacAttorney.GetCurrentDataSet(), "Attorney").Position = dgvSummary.Rows.Count
>
> SelectGridRow(e.RowIndex)
>
> ...
>
>
>SelectGridRow() is a function I added that basically just manually sets the selected grid row and ensures the scroll position is set so that the selected row is actually in view. This method works. The newly added row does become selected. However, my attempt to update the BindingContext position in the prior instruction fails, and so the very last record in the grid gets loaded into the detail view. Obviously this is not good when trying to add a new record.
>
>For position values I tried the grid row count (as above), the grid row count - 1, and also e.RowIndex. NONE of these work. In all cases the last record of the pre-existing data is loaded into the detail view.

I have not tried to do some of the things you are doing so just thinking about this. I would consider stepping into the framework code so you can see more specifically how the navigation affects the binding on the details page. If you are not comfortable with this, I could try this later to see more about what is happening behind the scenes. it may make more sense to put a mmButton on the form instead of the mmNewButton and code it yourself so you can have more control over the order of operations. Add the new Entity, re-select the new row, then switch to detail for edit.

Personally I like to just retrieve the full record of what I am going to edit rather than use the maintenance form because I can retrieve less data for the list. Especially if this is a windows application with data easily retrieved.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform