Databinding a grid to a WCF Plain Service

Thread is closed for posting
2 posts, 0 answers
  1. Jörgen
    Jörgen avatar
    10 posts
    Member since:
    Apr 2013

    Posted 18 Apr 2013 Link to this post

    I have created a N-Tier solution with a WCF Plain Service and OpenAccess ORM
    I have a table containing two columns categoryid and categoryname

    I have created a Windows Form with a Toolbar and a grid Control.

    I can call the WCF service and get an Array of categories

    I want to set the grids datasource to that Array and add new rows, update rows and delete rows and then save the Changes to the database. This doesn't work when the datasource is an Array.

    I converted the Array to a BindingList and set this as the datasource.

    Ran the Project and added a new row to the grid and tried to save the Changes to the database but this throws an exception.

    I would like to have a working sample solution that accomplishes this.
    I have looked at the SofiaCarRental sample but this is to complex
  2. Doroteya
    Doroteya avatar
    498 posts

    Posted 23 Apr 2013 Link to this post

    Hello Jörgen,

    According to the provided information, I would suggest you one of the following approaches:
    1) Create a custom binding list that inherits from BindingList<T> and inside it to call the corresponding methods of the service. Information about the BindingList<T> class is available here.
    2) Use the event handlers of the grid itself to call the necessary service methods
    3) If the service is generated with the Add OpenAccess Service wizard, you could use the step-by-step tutorial provided with the SofiaCarRental - WCF Plain Services with Windows Forms sample as guide lines. You can open it by selecting the sample and clicking on the OpenDocumentation... command.

    If you have additional questions, do not hesitate to get back to us.

    All the best,
    the Telerik team
    Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
Back to Top