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

[Solved] Handling null items databound combobox

3 Answers 223 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 28 Jul 2009, 10:54 PM
Hi All,

How can i make a null item to represent null values for a combobox in a  formview?

in a details view it might look like this:

<

 

asp:TemplateField ConvertEmptyStringToNull="true" HeaderText="Currency"

 

 

SortExpression="currencyID">

 

 

<EditItemTemplate>

 

 

<asp:DropDownList ID="DdlCurrencyEdit" runat="server"

 

 

AppendDataBoundItems="true" DataSourceID="SqlDSCurrencies"

 

 

DataTextField="currencyName" DataValueField="currencyID"

 

 

SelectedValue='<%# Bind("currencyID") %>'>

 

 

<asp:ListItem Value="">(none)</asp:ListItem>

 

 

</asp:DropDownList>

 

 

</EditItemTemplate>

 



Can i add an empty list item in a similar way in design view for combobox? also.. is there a convertEmptyStringToNull equivalent in formsview (i know not telerik related..) thanks.

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 03 Aug 2009, 12:44 PM
Hello Rich,

I am not exactly sure what do you mean by null items in RadComboBox?
You can add an item with empty Text and Value properties, is that null item for you?

You can add it from the designer just like you add any other combo item.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rich
Top achievements
Rank 1
answered on 05 Aug 2009, 06:23 PM
Hi,

To clarify i would like to have an item in the ComboBox that represents an empty/null value. These comboboxes are databound and i was wondering if there was a way in design view to set up an empty item rather than in code-behind. This way when it is bound and there is no value the "blank" item will be selected.

So basically can i add an empty item to a databound combobox in design view.
0
Veselin Vasilev
Telerik team
answered on 06 Aug 2009, 08:26 AM
Hi Rich,

Yes, you can.

Just make sure you have set the AppendDataBoundItems to True so both the bound and unbound items are shown in the combobox.

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Rich
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Rich
Top achievements
Rank 1
Share this question
or