Hi,
I need some functionality to be able to show some related data in a single row in the data grid. For that I planned to show a data grid in a cell of the grid.
For example below are my classes:
class A
{
public string A1;
public string A2;
public string A3;
public List<B> A4;
}
class B
public string B1;
public string B2;
public string B3;
class A with fields A1,A2,A3 & A4 ; another class B with fields B1, B2 & B3.
B1 is the primary key in B with A1 as its foreign key.
I need to show the data for each object of A in a single row including data of field A4 (type is B). So, in the grid I am expecting columns A1,A2,A3 & A4. I planned A4 to show as a combo and that combo will have a grid to show all the data for that field.
1. Is that possible to show a combo for a field in data grid?
2. Is that possible to attach a data grid to that combo box so that to display all the fields of that complex fields in the sub grid?
3. After achieving the above two points I have to ensure that user can select that combo box and change the pair of selected rows from the sub-grid. Also, the user should be able to select the complete row. So, is that possible to have row as well as cell selection (for some specific cells)?
PS: I am using Ultra Win Grid in a windows application.
Thanks in Advance for the help.
Hello Nitin,
There are different approaches to solve this task depending of your requirements. I made small sample for you with one possible approach. Could you please take a look at the attached smple for more details and let me know if you have any question.
Regards
Here is the sample
Hi Georgi,
I have already set DropDownStyle to DropDownList, but still the cell to which combo box is attached is coming as editable when I am clicking on drop down button and after selecting the value from the sub-grid.
Regards,
Nitin Jain
Hello Nitin,Did you try to set the columns Style property to 'DropDownList' and test this out again?
Hi Boris,
I have tried that also, but after applying Style to DropDown, the column is no more showing the drop down button.
Is it possible for you to amend the example from the previous post, so that I can tally the settings with my code.
Could you please review the sample attached to this post and see if it meets your requirements.Please feel free to let me know if I misunderstood you or if you have any other questions.
Thanks Boris,
This is exactly what I need. Actually by mistake (or by lack of knowledge) I set Cell's Style property to DropDown, which I guess was incorrect in both the manners.
But now after setting up columns style property I am getting a non-editable drop down control, that I needed.
Many Thanks to both of you for all the help provided.
That is awesome. This is exactly what I need from decorative point of view.
Thanks for the reply.
You could achieve this using the following code in the 'BeforeCellListDropdown' event:
ultraCombo1.DisplayLayout.Bands[0].Columns[1].Hidden = true; ultraCombo1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Custom";
Please feel free to let me know if a question about our tool set comes up on your mind.
Is there any way by which we can show certain columns and hide some when popping up the sub-grid in combo-box?
Also, Is it possible to change the display name of the columns in sub-grid?