Giter VIP home page Giter VIP logo

winforms-grid-crud-operations-odata's Introduction

WinForms Data Grid - CRUD operations (OData)

This example shows how to bind the WinForms Data Grid control to a BindingSource that gets data from OData services.

Unlike the Entity Framework data context, the OData service context does not have automatic change tracking (you must track changes manually). This example demonstrates how to handle grid events to track user edits.

Each time the user changes the value in a cell and commits the row, the GridView raises the RowUpdated event. Handle this event to notify the data context about the change. When a row has been deleted, the GridView raises the RowDeleted event.

private void GridView_RowUpdated(object sender, RowObjectEventArgs e) {
  if (e.RowHandle == GridControl.NewItemRowHandle) {
    this.Context.AddToOrders((Order)e.Row);
  } else {
    this.Context.UpdateObject(e.Row);
  }
}

private void GridView_RowDeleted(object sender, RowDeletedEventArgs e) {
  this.Context.DeleteObject(e.Row);
}
Private Sub GridView_RowUpdated(sender As Object, e As RowObjectEventArgs) Handles GridView1.RowUpdated
  If e.RowHandle = GridControl.NewItemRowHandle Then
    Me.Context.AddToOrders(CType(e.Row, Order))
    Else Me.Context.UpdateObject(e.Row)
  End If
End Sub

Private Sub GridView_RowDeleted(sender As Object, e As RowDeletedEventArgs) Handles GridView1.RowDeleted
  Me.Context.DeleteObject(e.Row)
End Sub

Files to Review

Documentation

winforms-grid-crud-operations-odata's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kashiash jsjxrj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.