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

How can I get the custom text to bind?

3 Answers 201 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
NT
Top achievements
Rank 1
NT asked on 03 Oct 2008, 06:23 AM
Hi there,

I am new to RadControls, and I have the problem as follows:

I put a Rad Combobox in the detailview. This combobox is bound with Sqldatasource so that the users can choose a item from this dropdownlist to insert/update into the database. Everything works fine.

But I also want to set to allow Custom text, and when users want something which is not in the list, they can type in the box whatever they want to create new items. But I cannot find how to bind this new typed items with the database. Nothing happens when I type new texts into the box.

Please help.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 03 Oct 2008, 11:53 AM
Heya NT,

Have you tried setting AllowCustomText=True on your combobox?  This should provide the desired functionality.  :)
0
NT
Top achievements
Rank 1
answered on 03 Oct 2008, 12:48 PM

Thanks for your reply.

Sure, I have set AllowCustomText="True". This allows me to type in the box perfectly. And I think my data binding is ok, because it works well when I choose items in the dropdownlist, but not with what I type in the box.

Below is my code.


<
InsertItemTemplate>

<telerik:RadComboBox ID="rcbAddMenuGroup" runat="server" AllowCustomText="True" AppendDataBoundItems="True" DataSourceID="SqlDataSourceAddMenuGroup" DataTextField="cMenuGroup" DataValueField="cMenuGroup" EmptyMessage="Gõ tên để tạo nhóm mới, hoặc chọn từ danh sách hiện có." EnableItemCaching="True" EnableVirtualScrolling="True" ErrorMessage="Error." Font-Names="Arial" Font-Size="X-Small" HighlightTemplatedItems="True" LoadingMessage="Loading..." MarkFirstMatch="True" OffsetY="5" Skin="Default2006" Sort="Ascending" Style="position: relative; top: 0px; left: 0px;" Width="500px" SelectedValue='<%# Bind("cMenuGroup") %>'>

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadComboBox>

</InsertItemTemplate>

0
Rosi
Telerik team
answered on 03 Oct 2008, 01:09 PM
Hi NT,

You can subscribe to TextChanged event of RadComboBox and update the database in its event handler.

All the best,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
NT
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
NT
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or