This is a migrated thread and some comments may be shown as answers.

Editing child records on radgrid

1 Answer 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 17 Jul 2013, 10:19 PM
I have a situation where I have a collection of parent objects named "contact" bound to the radgrid.  That contact object has a child object called "products".  It's a one to many relationship from contact to products (one contact has many products, but will be limited to around 10 products per contact). 

So I'm basically rolling up the description of the product collection into one string for display purposes in the last column of the grid, but I'm also keeping them as separate properties in the products object for updating and adding records to it.

So it's displayed like this in the grid:

contact name        contact address       contact phone      products covered
---------------------------------------------------------------------------------------------------
Bob Jones            123 oak st.               123-123-1234       loans, accounts, sales

But it's standard object in code.

class products
{
    int contactid;
    int productid;
    string description;
}

When I go into edit mode I would like to be able to have checkboxes for each product type description so I can select or deselect them for each contact before saving them.  I followed an example I found to edit child objects in a radgrid and it ends up just giving me a single textbox with a comma separated list of products exactly how they are listed in the grid.  I need to be able to have checkboxes for each product item in the edit popup box.  Is there a way to do this?  I've had no luck finding an example.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 Jul 2013, 02:49 PM
Hi Jeff,

Thank you for contacting us.

You can enable the CheckBoxes of the generated combo box when using a GridDropDownColumn:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/checkboxes/defaultcs.aspx
and use the update/insert command server events to loop through the selected values in Edit mode:
( Section Accessing controls in edit/insert mode )
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html

You could also use a Edit Form Template to achieve the requested functionality:
Grid / Form Template Edit Form

I hope this will prove helpful. Please let us know if you need further assistance.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Jeff
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or