BO does not navigates to the new row for editing


Author
Message
dgsoft
dgsoft
StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
Hi,

In my baseclass I try to add new row.

1) I have an Treeview with DataSource as BBS

2) I get reference to BO over BBS.BusinessObject

3) Try to add new record with BO.add()

4) Try to update some properties of BO



As result - I update properties of row, where currently cursor located. and after .Add() pointer does not navigates new row. Why?



Here is completed code for this



If Not IsNothing(Pmks_treeview) Then

If Not IsNothing(Pmks_treeview.DataSource) Then

Dim loBBS As MicroFour.StrataFrame.Business.BusinessBindingSource = TryCast(Pmks_treeview.DataSource, MicroFour.StrataFrame.Business.BusinessBindingSource)

If Not IsNothing(loBBS) Then

Dim loBO As MicroFour.StrataFrame.Business.BusinessLayer = TryCast(loBBS.BusinessObject, MicroFour.StrataFrame.Business.BusinessLayer)

Dim lcParentId_Field As String = Pmks_treeview.ParentFieldName

If Not String.IsNullOrEmpty(lcParentId_Field) Then

loBO.Add()

loBO.GetType().GetProperty(lcParentId_Field).SetValue(loBO, tnParentId, Nothing)

If Not String.IsNullOrEmpty(Pmks_treeview.pmks_group_caption_fieldname) Then

loBO.GetType().GetProperty(Pmks_treeview.pmks_group_caption_fieldname).SetValue(loBO, Pmks_treeview.pmks_default_group_caption, Nothing)

End If

loBO.Save()

End If

End If

End If

End If



Thanks

Denis
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, first, I cannot give you a straight answer about the tree view as I don't know what control you are using nor how they interpret the IBindingList implementation. So the first thing that you need to do is remove the tree view from the formula altogether and just add a new row through the BBS. Another option is to just drop on a DataGridView and see if it works. This will tell you if the issue is the tree view or some other code.



Second, I don't understand why you are using reflection to set the parent field. You are talking to a BO, so if lcParentId_Field is a column in the underlying data table, then you most definitely don't want to use reflection. You should do this instead:



loBO.CurrentRow.Item(lcParentId_Field)




And if the field is a custom property only, then you could possibly do this depending on how the custom property is defined (GetCustomBindablePropertyDescriptors must know about the property to do this):



loBO.Item(lcParentId_Field)

dgsoft
dgsoft
StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)StrataFrame User (145 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
Hi Trent,

Thanks for response,

About BO.item(Fieldname) Ok Smile)) I see...



About Add new row..



loBO.Add

loBO.MoveLast()



Then update Data - it works perfect.. but just Add - does not navigate row.



Denis
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)Advanced StrataFrame User (964 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Not sure if this applies in your case but be aware that filters in effect can cause this behavior. If you have one set (including the filter implicit in automatically filtering child records against the parent) under some cirumstances this can get weird results in moving to the current row.)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search