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

[Solved] Finding a combo box in edit cell template inside grid

3 Answers 281 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Amit Patel
Top achievements
Rank 1
Amit Patel asked on 22 Oct 2009, 01:33 PM
How can i find a combo box that inside of CellEdit template?  I tried your extension method, but when i first click on the cell i am on reguler mode, so i think it tries to search in reguler cell template.  Thanks, Amit

 

 

<telerik:GridViewDataColumn.CellEditTemplate>

 

 

 

<DataTemplate>

 

 

 

<ComboBox Name="_comboBoxAttributeValue" Loaded="OnComboBoxAttributeValueLoaded"

 

 

SelectionChanged="ComboBox_SelectionChanged">

 

 

 

<ComboBox.ItemTemplate>

 

 

 

<DataTemplate>

 

 

 

<CheckBox Content="{Binding Path=Name}" Click="CheckBox_Click" />

 

 

 

</DataTemplate>

 

 

 

</ComboBox.ItemTemplate>

 

 

 

</ComboBox>

 

 

 

</DataTemplate>

 

 

 

</telerik:GridViewDataColumn.CellEditTemplate>

 

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 22 Oct 2009, 02:46 PM
Hi Amit Patel,

You are right - the cell initially does not contain the combo . It will appear in the visual tree after user has entered the edit mode of the cell .

Can you please give me some more details on what you are trying to achive , so we can find some descent workaround.

All the best,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Amit Patel
Top achievements
Rank 1
answered on 22 Oct 2009, 04:02 PM
Pavel thanks for the quick response! I am trying to get the checked items inside of comboBox, and display them in the text block. In order do that, i need to get hold of combo, and the foreach checked item, get the value and display in the textBlock inside cellTemplate.  
0
Accepted
Pavel Pavlov
Telerik team
answered on 27 Oct 2009, 01:33 PM
Hello Amit Patel,

I have prepared a small example for you . I have tried to resemble your scenario as close as possible :
It demonstrates a way to store and transfer the checked items from the combo to the display mode of the cell.

Here is the approach I have used :
I have redefined both - the CellEditTemplate and The CellTemplate.

The CellEditTemplate has a tiny user control within . This control takes care to "foreach " the selected items and store the values in the business object .

The CellTemplate contains a small ItemsControl to display the selected values when in "regular" mode.
(you can replace it with a user control with a textblock if needed).

Please review the attached project. In case it is not close enough to your requirements I will be glad to elaborate on it.

Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Amit Patel
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Amit Patel
Top achievements
Rank 1
Share this question
or