CRUD and custom insert row

2 posts, 0 answers
  1. Tomaz
    Tomaz avatar
    5 posts
    Member since:
    Jan 2012

    Posted 10 Jan 2012 Link to this post


    we have just recently aquired Telerik Premium Collection and while exploring its rich funcionality a few questions have arisen about GridView. We are using WinForms and OpenAccess Q3 2011.

    1) In combination with OpenAccess what is the best approach when trying to implement automatic CRUD operations on gridview, so far we have looked in knowledge base, code library and demos but information about this is scarce. So how can CRUD be implemented using only grid and binding source without any code behind?

    2) Is it possible to have a custom insert template (like in ASP.NET Ajax Grid - InsertItemTemplate) in GridView which can be customized either in code or with Property Builder? Or is it possible to change the GridNewRowElement during grid binding and which event to use?

    As an example lets say we have a simple table City in database with ID, Country_ID, State_ID, Name and Description columns. When we bind the grid using BindingSource we show only ID, Name and Description columns and also set the ID coulmn to be read only, however when the user wants to insert a new row the ID column should not be read only because we want the user to manually set the ID. Moreover the insert row should have two comboboxes using its own data sources (from Country and State tables) which would enable the user to select appropriate values from a dropdown menu (county name and state name). Basically we want to have two templates - one for view and one for insert (and potencially also an edit template).

    3) Since we are using OpenAccess, is it possible to extract a doimain class object bound to a row during/after edit (in CellValueChanging/Changed) so we dont have to use e.Row.Cells[x].Value beacuse its more error prone?

    Any kind of samples (projects especially) or links would be greatly appreciated.
  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 12 Jan 2012 Link to this post

    Hi Tomaz,

    Thank you for writing.

    I am getting straight to your questions:

    1) Please refer to our online documentation for information regarding synchronizing RadGridView with OpenAccess. The OpenAccess infrastructure implements IBindingList interface and this allows automatic synchronization for any CRUD operations between RadGridView control and its DataSource.

    2) Yes, it is possible. You can implement new custom row using the codebase of our Custom Filter Row example in our Winforms Demo Application. The example is located in RadGridView section > Filtering > Custom Filter Row

    3) You always have access to mapped domain class object using DataBoundItem property of GridViewRowInfo.

    I hope this information is useful. Let me know if you need further assistance.

    Julian Benkov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Back to Top