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

Unbound Custom Cell

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Velma
Top achievements
Rank 1
Velma asked on 15 Jan 2014, 08:09 PM
My need seems fairly straightforward, but after poring through help text, forum postings, example apps, and making many trials, I still can't make the whole picture work--I'm missing a couple of key pieces.

.NET C# Winforms, Telerik 2013.1.321.20

The RadGrid is unbound. The data is populated (so far) through creating a new row with "GridViewRowInfo row = Grid.Rows.NewRow(), and then iterating through the cells of the row and setting the value of the GridViewCellInfo.

I need multiple columns of a custom cell type. Each cell contains a multicolumn combo box bound to a datatable (the same for all cells), a text box or label to display a value, and a button. The combo box should display all the time (as would an individual one on the form), not just when the cell is selected. I need to catch the combo box change, and handle it, potentially through methods on the parent form. The label is display only. The button needs to open a dialog form with access to the info from the cell, and again I need to reach back to the parent form. I need to be able to change the formatting on cell initialization, for the selected cell, and when the data changes. And that's it. No new rows after initialization, no sorting, no filtering, no reordering columns.

I can create the elements in CreateChildElements on the cell, and I can arrange them in ArrangeOverride on the cell. I can do some formatting in the Grid_CellFormatting event.

So these seem to be my stuck places:

o I don't seem to be able to inherit my column from GridViewMultiColumnComboBoxColumn, because I need the combo box to show all the time, not just when the cell is in edit mode. AND because I cannot find a cell element for the Multi Column Combo parallel to GridComboBoxCellElement. I can bind and set up the combo box in Grid_CellBeginEdit, but in that case it only shows when it is in edit mode. So what is my best way to get the combo box set up for the cells? (Bind the datatable, set DisplayMember, and ValueMember, set up the MultiColumn grid dropdown, set an event handler.)

o I need to pass at least three values to the cell--the selected value for the combo box, the value to display in the label, and an ID. I believe I can pass all of these to the cell in a small object or tuple in the Value or Tag,. But how do I get them to populate the objects at the right time? I think I'm having some major misunderstanding between the logical cell and the visual cell. I need to store these values in the logical cell and populate the visual cell at the right time--but how exactly, because what I've tried has made everything confused, and the values changed on all the combo boxes at once.

o What is my best way to handle the SelectedIndexChanged or SelectedValueChanged event on the combo box and the Click event on the button, with access to (ideally) methods on the parent form and values from the cell? (I might be able to pass an object reference to the form or an object on the form in the tag, if there is no direct access to methods and properties of the parent form.)

o What is my best way to handle cell formatting, including formatting the controls within the cell (e.g., combobox backcolor) on initialization, on value changed, and on current? So far I haven't seen how to get to the child controls on the Grid_CellFormatting.

Any help will be greatly appreciated.


1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 20 Jan 2014, 04:14 PM
Hi Velma,

Thank you for contacting us.

You have contacted us through via the support ticketing system as well and the case is still in progress. As soon as it is resolved we will update this thread will the most recent information so the community can benefit from it in future.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Velma
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or