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

[Solved] RadGridview:populate programmatically combobox based on row value

9 Answers 351 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.
Asaf
Top achievements
Rank 1
Asaf asked on 08 Dec 2010, 04:36 PM
Hi,

I want to use Combobox in RadGridview as following:

<telerik:RadGridView Grid.Column="0" Grid.Row="0" x:Name="radGridBidRows" AutoGenerateColumns="False" Margin="10,10,10,0"

SelectionUnit="FullRow" CanUserSelect="True" SelectionMode="Single" >

<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn IsVisible="False" IsReadOnly="True" DataMemberBinding="{Binding BID_ROW_ID}" Header="BID_ROW_ID" />

 

 

 

 

 

<telerik:GridViewDataColumn SortMemberPath="POL_CODE" Header="POL CODE">

 

 

 

 

 

<telerik:GridViewDataColumn.CellTemplate>

 

 

 

 

 

<DataTemplate>

 

 

 

 

 

<StackPanel Orientation="Horizontal">

 

 

 

 

 

<HyperlinkButton x:Name="ExHyperlink" Click="ExHyperlink_Click" Content="Details"></HyperlinkButton>

 

 

 

 

 

<telerik:RadComboBox x:Name="cmbPOL_CODE" />

 

 

 

 

 

</StackPanel>

 

 

 

 

 

</DataTemplate>

 

 

 

 

 

</telerik:GridViewDataColumn.CellTemplate>

 

 

 

 

 

</telerik:GridViewDataColumn>

 

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

 

</telerik:RadGridView>

 

 

How can I populate programmatically combobox based on row value BID_ROW_ID?

Thanks in advance,
Moshe

9 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 08 Dec 2010, 04:46 PM
Hi Asaf,

You may try out the approach demonstrated in this blog post. However, instead of handling the SelectionChanged event of the first ComboBox, all you need to do is to provide your ComboBox with the necessary data source - as it is the AvailableCountries in the example.
 

All the best,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Moni
Top achievements
Rank 1
answered on 08 Dec 2010, 04:48 PM
<telerik:RadGridView
            Name="radGrdYourName" 
            Grid.Row="0"
            Style="{StaticResource radGridViewStyle}"
            RowEditEnded="radGrdYourName_RowEditEnded"
            CellEditEnded="radGrdYourName_CellEditEnded"
            ItemsSource="{Binding ElementName=vwYourDomainDataSource, Path=Data}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewComboBoxColumn
                    Header="Your Header" 
                    Width="150"
                    DataMemberBinding="{Binding YourColumnID}"
                    ItemsSource="{Binding Data,Source={StaticResource YourStaticResource}}"
                    DisplayMemberPath="YourDataFileldName"
                    SelectedValueMemberPath="YourColumnID"
                    IsReadOnly="False" >
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
0
Asaf
Top achievements
Rank 1
answered on 09 Dec 2010, 01:30 PM
Hi Maya,
I saw http://blogs.telerik.com/pavelpavlov/posts/10-01-27/cascading_comboboxes_selection_in_radgridview_for_silverlight_and_wpf.aspx that you sent.

But it's not exactly example that I need.
I'm using telerik:GridViewDataColumn.CellTemplate and Label with RadComboBox in celltetemplate of Gridview.
Can you give me such example?
I know that I can use  telerik:GridviewComboColumn,but I want to use celltetemplate.

Thanks in advance,
Moshe
0
Maya
Telerik team
answered on 09 Dec 2010, 04:09 PM
Hello Asaf,

I am sending you a sample project illustrating a possible approach for achieving the desired result. The ItemsSource of the RadComboBox depends on the value of another property of the item.
I hope that helps.
 

All the best,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Asaf
Top achievements
Rank 1
answered on 12 Dec 2010, 12:03 PM
Hi Maya,
Can you give the same example that uses WCF service?
 
Thanks,
Moshe

0
Asaf
Top achievements
Rank 1
answered on 12 Dec 2010, 12:04 PM
Hi Maya,
Can you give the same example that uses WCF service?
 
Thanks,
Moshe

0
Maya
Telerik team
answered on 13 Dec 2010, 09:43 AM
Hello Asaf,

Basically, you may follow up the same approach as the one demonstrated in the sample project I have sent. You may extend the functionality of your classes by adding partial classes and add the necessary properties - like AvailableCountries and methods - like UpdateAvailableCountries(). The settings in the xaml file should be again similar to those in the sample. 

Greetings,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Asaf
Top achievements
Rank 1
answered on 14 Dec 2010, 08:56 AM
Hi Maya,
Can you give me example of wcf service  called synchronously(not asynchronously) that for given row key(bid_row_id) in Row_Loaded event binds to ItemsSource that calculated depended on bid_row_id value?
And then I can use in code DataMemberBinding, SelectedValueMemberPath, DisplayMemberPath, ItemsSourceBinding values to
add binding values to existing GridViewComboBoxColumn or to use these values to bind for existing RadCombobox in celltemplate.
I know that Silverlight supports only asynchronous calls.

Thanks,
Moshe
0
Maya
Telerik team
answered on 15 Dec 2010, 05:51 PM
Hello Asaf,

I am sending you a sample project illustrating another possible approach for achieving the desired result. You may extend its functionality depending on your exact requirements by updating the service call CustomersList and return those whose RowID corresponds to the CustomerID for example. 

All the best,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Asaf
Top achievements
Rank 1
Answers by
Maya
Telerik team
Moni
Top achievements
Rank 1
Asaf
Top achievements
Rank 1
Share this question
or