Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Edit the focused grid row in DataLayoutControl in Server Mode.

License

NotificationsYou must be signed in to change notification settings

DevExpress-Examples/winforms-grid-edit-row-server-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Data Grid - Edit the focused row in DataLayoutControl in Server Mode

Server Mode does not work if you bind the GridControl and DataLayoutControl to the same collection, and use the DataLayoutControl as the grid's Edit Form, because the CurrencyManager does not manageServer Mode Data Sources. All Server Mode data sources except forXPServerCollectionSource are read-only.

This example handles theFocusedRowChanged event to synchronize the DataLayoutControl's data source (XPBindingSource orBindingSource) with the focused row in the GridControl.

Implementation details

  1. Bind theDataLayoutControl to a data source in the Visual Studio Designer.
  • If your ORM is XPO, add theXPBindingSource component from the toolbox.
    1. Rebuild the project.
    2. Select theXPBindingSource.ObjectClassInfo property in the Properties window, open the drop-down list, and choose an appropriate XPO class.
    3. AssignXPBindingSource to theDataLayoutControl.DataSource property.
  • If your ORM is EF or a different library, add theBindingSource component from the toolbox.
    1. Rebuild the project.
    2. Click theProject > Add New Data Source menu item.
    3. Choose the Object Data Source Type and click Next.
    4. Choose an appropriate class in the list and clickFinish.
    5. AssignBindingSource to theDataLayoutControl.DataSource property.
  1. Retrieve data fields.
  2. Select theGridView and subscribe to theFocusedRowChanged event.
  3. Use thee.Row property to obtain a data object that corresponds to the focused row and add it to the data source.

Example: XPBindingSource

privatevoidGridView_FocusedRowObjectChanged(objectsender,FocusedRowObjectChangedEventArgse){XPBindingSource.DataSource=Session.GetLoadedObjectByKey<ServerSideGridTest>(e.Row);}
PrivateSubGridView_FocusedRowObjectChanged(ByValsenderAsObject,ByValeAsFocusedRowObjectChangedEventArgs)XPBindingSource.DataSource=Session.GetLoadedObjectByKey(OfServerSideGridTest)(e.Row)EndSub

Example: BindingSource

privatevoidGridView_FocusedRowObjectChanged(objectsender,FocusedRowObjectChangedEventArgse){objectobj=DbContext.ServerSideGridTests.Single(e.Row);BindingSource.Clear();BindingSource.Add(obj);}
PrivateSubGridView_FocusedRowObjectChanged(ByValsenderAsObject,ByValeAsFocusedRowObjectChangedEventArgs)DimobjAsObject=DbContext.ServerSideGridTests.Single(e.Row)BindingSource.Clear()BindingSource.Add(obj)EndSub

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Edit the focused grid row in DataLayoutControl in Server Mode.

Topics

Resources

License

Stars

Watchers

Forks

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp