Looking for Example on Grid and Forms Editing with Table and Views

2 posts, 0 answers
  1. Lee
    Lee avatar
    49 posts
    Member since:
    Feb 2010

    Posted 08 Feb 2017 Link to this post


    Let me describe the example i am looking for.  Lets say we have following tables.

    EMPLOYEE ( EmpNo, Name, FK_DepartmentNo, FK_RoleID)    -- FK stands for foreign key.

    DEPARTMENT (DeptNo, DepartmentName)

    ROLE ( RoleID, RoleName)

    VIEW_EMPLOYEE( EmpNo, Name, DepartmentName, RoleName)

    Now I want to use CRUD operation on EMPLOYEE table using Grid.  While listing data in grid, I will list data from View_Employee, but while editing grid I want Insert/Update/Delete to act on EMPLOYEE table.  I want to use Form Template during Edit, so that i can bring appropriate list to fill into Department and Role Dropdown controls respectively.  

    Can anyone point me to such a real life example to understand how it can be done with telerik grid.

    The Telerik samples of grid shows examples where data comes from single table like Contacts Table or Products Table with simple text columns and that does not simulate real world scenarios.  Hence i am asking this question here.






  2. Eyup
    Eyup avatar
    4046 posts

    Posted 13 Feb 2017 Link to this post

    Hello Lee,

    You can access the GridEditableItem instance directly using e.Item argument during the UpdateCommand, InserCommand or ItemCommand event handler and depending on your edit mode you can get the values manually:

    In some scenarios, the ExtractValues method can be helpful:

    If you are using templates, make sure that you are using the Bind expression in the form controls in your :

    For example - Text='<%# Bind("SomeField") %>' in order to pass the data back to the query, similar to this live sample:

    As for editing with combo, the most straightforward way of achieving this is placing a combo control inside the EditItemTemplate of GridTemplateColumn:

    And make avail of the SelectedValue property and the Bind expression as mentioned above.

    Alternatively, you can use GridDropDownColumn:

    The GridDropDownColumn generates a combo control only during insert or edit mode:

    I hope this will prove helpful.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top