Under Review
Last Updated: 11 Aug 2014 08:21 by Dennis
Dennis
Created on: 05 Aug 2014 11:59
Category: ComboBox
Type: Feature Request
2
ComboBox/DropdownList handle DBNull in FormView
In a FormView, a routine scenario is to provide a control that has some sort of picklist (either DropDown or ComboBoxList) that may be tied to a field that contains a DBNull.

An example might be where one of the fields in the Telerik Profile specifies their favorite Telerik Product (KendoUI, ASP.NET AJAX, etc.).  However, their might be profiles where the user has not selected a favorite product.  Assuming that the Product list comes from a related table, then this field (say, FavoriteProductId) in the Profile would contain a DBNull.

I would like Telerik to add "declarative" functionality on the RadComboBox and RadDropDownList to handle the case where SelectedValue = DBNull.

Below is an example of what this might look like for a RadComboBox (inside of a FormView -- note: only showing the RadComboBox declaration).

<telerik:RadComboBox Style="z-index: 9100"  ID="rcbFirstOrder" runat="server" Width="50px" SelectedValue='<%# Bind("FirstOrder") %>'     HandleDBNull="true" >
    <Items>
        <telerik:RadComboBoxItem runat="server" Text="" Value="DbNull (or Null or Nothing)" />
        <telerik:RadComboBoxItem runat="server" Text="No" Value="0" />
        <telerik:RadComboBoxItem runat="server" Text="Yes" Value="255" />
    </Items>
</telerik:RadComboBox>

Notice the new property ---    HandleDBNull = true       and the ability to define the value on a RadComboBoxItem as DBNull (or null or nothing) -- some string to define DBNull.

Although the above example shows all the RadComboBoxItems defined declaratively, this scenario could easily be extended to use AppendDataBoundItems = true and the non-DBNull values to come from a Data Source.

Thanks for taking the time to consider this functionality.  This enhancement would remove all of the code-behind tweaks that are currently incorporated to use a ComboBoxList / DropDownList with a database field that can contain DBNull.



0 comments