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

[Solved] Autocompletion in GridView GridViewColumn lets user type items which are not in the list

3 Answers 76 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.
Paul Brause
Top achievements
Rank 1
Paul Brause asked on 09 Feb 2011, 03:47 PM

Hi,

I am using a GridViewComboBoxColumn in a RadGridView.
The GridView and the GridViewComboBoxColumn are populated via RIA Services.
  So far everything is working.

The problem ist that I cannot get the comboboxes in the GridView to only enable
  the user to type text into the comboboxes that is contained in the combobox items!

Using a RadComboBox outside a GridView works fine.

Example: the combobox column in the GridView contains following items:

Bremen
Hamburg
Dotmund

When I press the delete key in the combobox I can delete the contents of the box,
I can also type New York, if I want to,
and when the user wants to save the GridView content, he gets an error message because
he typed an element that is not contained in the combobox!!!

How can I prevent the user to enter or select items that are not contained in the combobox?

As I mentioned before, the standard RadCombBox offers this behaviour.

Thanks very much!

Janni

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Feb 2011, 03:56 PM
Hi Paul Brause,

You can set the IsComboBoxEditable property of the combo column to False.


All the best,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Paul Brause
Top achievements
Rank 1
answered on 09 Feb 2011, 05:04 PM

Hi Veselin,

sadly this eliminates the possibility to type in text like into a textbox.
I am not able to type more than character which helps finding items in comboboxes containing several hundred items.
I cannot type beer to find the first entry starting with beer!
It only allows me to type one letter.

As I mentioned before, the standard RadComboBox offers this behaviour!

0
Accepted
Veselin Vasilev
Telerik team
answered on 10 Feb 2011, 03:03 PM
Hi Paul Brause,

In addition to setting that property you need to set the IsReadOnly="True" property of the combobox. This can happen through the EditorStyle property of the combobox column:

<telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding AvailableCountries}"
                                DataMemberBinding="{Binding CountryID}"
                                DisplayMemberPath="Name" 
                                IsComboBoxEditable="True"
                                SelectedValueMemberPath="ID">
            <telerik:GridViewComboBoxColumn.EditorStyle>
                <Style TargetType="telerik:RadComboBox">
                        <Setter Property="IsReadOnly" Value="True" />
                 </Style>
            </telerik:GridViewComboBoxColumn.EditorStyle>
</telerik:GridViewComboBoxColumn>

Hope this helps.

Kind regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Paul Brause
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Paul Brause
Top achievements
Rank 1
Share this question
or