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

Simple use as the old days ...

8 Answers 51 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Waleed Seada
Top achievements
Rank 2
Waleed Seada asked on 01 Mar 2011, 02:23 PM
Dear All,

My needs are very primitive.

I have a table [Accounts] that references other tables using their ID's .. [CoinID], [sheetID], .... etc
I need to bind RadComboBox to different ID's so the enduser will select the displayed name from the combo, and the application will keep the ID of the selected name... simple scenario ...how to ??

I manage to bind the combobox to different lists in my VM but can't get the selected ID back to my VM ??

Also, If I need to display the accounts in a grid and I need to bind each row to different ID's with the previous scenario... how to ??
I went through the help, but I couldn't touch this area ..

Any help is appreciated
Regards
Waleed

8 Answers, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 03 Mar 2011, 12:48 PM
Hi Waleed,

To make it work, you have to bind the ComboBox as follows:
- DisplayMemberPath property is for the Text part of the object
- SelectedValuePath is for the ID, and then SelectedValue is the property which will hold the selected ID
For more information about ComboBox in GridView you can refer to this help article -> http://www.telerik.com/help/silverlight/radgridview-columns-column-types-combobox-column.html

Hope this information helps. Please let us know if you have further questions.

Greetings,
Konstantina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Waleed Seada
Top achievements
Rank 2
answered on 04 Mar 2011, 04:06 PM
Dear Konstantina,

Your reply help me very much to show the correct text in the dropdown box.
But the other properties are not working.. let me explain in details:

I have a little bit complex scenario,
The page is showing the sheets list in a grid, for each row there is a combobox to select the posted sheet which should be any other sheet & not the current one (the current one shouldn't be in the list)

To simplify this I just used the same collection to show values in the combobox (as it will be read only).

I have QueryableDomainServiceCollectionView Sheets collection in my VM as follows:
private QueryableDomainServiceCollectionView<sheet> _sheetItems;
public QueryableDomainServiceCollectionView<sheet> SheetItems
{
    get{ return _sheetItems; }
    set{ _sheetItems = value; RaisePropertyChanged("SheetItems"); }
}

Which is populated from the database on the page loaded event.
Here it comes the binding in XAML:
<telerik:RadGridView x:Name="SheetGrid" 
                ItemsSource="{Binding Path=SheetItems}" 
                AutoGenerateColumns="False"
                DataLoaded="SheetGrid_DataLoaded"
                ShowGroupPanel="False"
                IsBusy="{Binding IsBusy}"
                >
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding sheet_id}"/>
        <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding sheet_name_1}"/>
        <telerik:GridViewDataColumn Header="English" DataMemberBinding="{Binding sheet_name_2}"/>
        <telerik:GridViewDataColumn Header="Posting Sheet" DataMemberBinding="{Binding posting_sheet}"/>
        <telerik:GridViewComboBoxColumn Header="Posting Sheet" UniqueName="PostingSheetID"
                                                  DataMemberBinding="{Binding posting_sheet}"
                                                  ItemsSource="{Binding Path=SheetItems}"
                                                  DisplayMemberPath="sheet_name"
                                                  SelectedValueMemberPath="sheet_id"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

If I edit the row I can see the list populated with the values, and If I select any value it gets reflected back to the column value, but the text will disapper if I move away the column. ...

What is wrong here, should I define another collection, if so how can I assign the id of the current sheet not to be shown in the list ..

any help is appreciated
Waleed


0
Konstantina
Telerik team
answered on 08 Mar 2011, 12:16 PM
Hi Waleed,

Since you are using the ComboBox in the GridView you might find useful checking out this help article.

Please let us know if that worked for you.

Greetings,
Konstantina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Waleed Seada
Top achievements
Rank 2
answered on 08 Mar 2011, 03:27 PM
Dear Konstantina,

I am having a nightmare dealing with the RadComboBox (probably the normal combobox, I never tried that).

I have a simple QueryableDomainServiceCollectionView that is loaded with the page load event.
I have bounded to the GridCombobox as follows:
<telerik:RadGridView x:Name="SheetGrid" 
                                    ItemsSource="{Binding Path=SheetItems}" 
                                    AutoGenerateColumns="False"
                                    DataLoaded="SheetGrid_DataLoaded"
                                    ShowGroupPanel="False"
                                    IsBusy="{Binding IsBusy}"
                                    >
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding sheet_id}"/>            <telerik:GridViewDataColumn Header="Posting Sheet" DataMemberBinding="{Binding posting_sheet}"/>
        <telerik:GridViewComboBoxColumn Header="Posting Sheet" UniqueName="PostingSheetID"
                  DataMemberBinding="{Binding posting_sheet, Mode=TwoWay}"
                  ItemsSource="{Binding Path=PostSheets}"
                  DisplayMemberPath="sheet_name"
                  SelectedValueMemberPath="sheet_id"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

The list is displayed fine, but not reflecting the corresponded label for the current posting_sheet of each row, I have tried the ItemsSourceBinding but not showing any.

I have another issue but can't go for it now, until I finish this first.

Any Help is appreciated
Waleed
0
Konstantina
Telerik team
answered on 14 Mar 2011, 10:02 AM
Hello Waleed,

I am afraid I couldn't understand how exactly this is not reflecting the corresponded label? Could you please give us some more details about what exactly is the problem. Also, if you could send us your implementation of the business object it would be really helpful.

Looking forward to your reply.

All the best,
Konstantina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Waleed Seada
Top achievements
Rank 2
answered on 14 Mar 2011, 03:01 PM
Very well,

Here is the business objects I am dealing with:
private QueryableDomainServiceCollectionView<IGL_sheet> _sheetItems;
public QueryableDomainServiceCollectionView<IGL_sheet> SheetItems
{
    get{ return _sheetItems; }
    set{ _sheetItems = value; RaisePropertyChanged("SheetItems"); }
}
private QueryableDomainServiceCollectionView<IGL_sheet> _postSheets;
public QueryableDomainServiceCollectionView<IGL_sheet> PostSheets
{ get { return _postSheets; } set { _postSheets = value; RaisePropertyChanged("PostSheets"); } }

Nothing complicated here ... then I just binding the grid.ItemsSource to SheetItems and the ComboBox.ItemsSource to PostSheets.
The XAML is here as well:
<telerik:RadGridView x:Name="SheetGrid" 
                                    ItemsSource="{Binding Path=SheetItems}" 
                                    AutoGenerateColumns="False"
                                    DataLoaded="SheetGrid_DataLoaded"
                                    ShowGroupPanel="False"
                                    IsBusy="{Binding IsBusy}"
                                    
    <telerik:RadGridView.Columns
        <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding sheet_id}"/>            <telerik:GridViewDataColumn Header="Posting Sheet" DataMemberBinding="{Binding posting_sheet}"/> 
        <telerik:GridViewComboBoxColumn Header="Posting Sheet" UniqueName="PostingSheetID"
                  DataMemberBinding="{Binding posting_sheet, Mode=TwoWay}"
                  ItemsSource="{Binding Path=PostSheets}"
                  DisplayMemberPath="sheet_name"
                  SelectedValueMemberPath="sheet_id"/> 
    </telerik:RadGridView.Columns
</telerik:RadGridView>

The posting_sheet is the column used to display the value stored in the record for each sheet.
Further more here is the code I use to plump the data:
SheetItems = DataService.GetSheets();
SheetItems.Load(); 
SheetItems.LoadedData += (s, a) => { SheetItems.MoveCurrentToFirst(); }; 
SheetItems.CurrentChanged += SheetItems_CurrentChanged; 
PostSheets = DataService.GetSheets(); 
PostSheets.Load(); 

Hope this is enough to tell what the problem could be ...
Regards
Waleed
0
Konstantina
Telerik team
answered on 16 Mar 2011, 09:56 AM
Hi Waleed,

Have you managed to get  it work? If you still experience the issue you could refer to this help article for more information, and let us know if that worked for you.

Regards,
Konstantina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Waleed Seada
Top achievements
Rank 2
answered on 17 Mar 2011, 01:50 PM
I am still stuck with it ...

I have opened a support ticket with number 404432 with a small video demonistrating the issue.

Best regards
Waleed
Tags
ComboBox
Asked by
Waleed Seada
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Waleed Seada
Top achievements
Rank 2
Share this question
or