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

Request for New Feature: DefaultValue

3 Answers 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 21 Jun 2011, 05:46 PM
Would you guys please consider adding a new property to all controls that have a DBValue or DBSelectedValue property? The new property would be called DefaultValue. Example use case:

We use the FormView control for the View/Insert/Edit of records. We use ObjectDataSource binding to Telerik controls inside the FormView. We pass an object (not fields) between the FormView and the ObjectDataSource. When in the insert mode, some Telerik controls such as RadDatePicker and RadNumericTextBox are bound to the object and set to null. Currently we have to set up a OnDataBinding event to set the default values for each control. It would be extremely helpful if we could just set a new property to the default value in this case.

Edited: I did find that we could set the Value property for a RadNumericTextBox and it would work as a default value on insert; however, other controls like checkbox don't.

Example:

<telerik:RadNumericTextBox ID="numPurchasedPrice" runat="server" Type="Currency"
DataType="System.Decimal" MinValue="0" MaxValue="100"  DefaultValue="0"
        DbValue='<%# Bind("PurchasedPrice") %>' >
</telerik:RadNumericTextBox>

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 24 Jun 2011, 08:15 AM
Hi Brian,

Currently we do not have plans for implementing the described functionality into our controls. However I will forward your request to our developer department for further consideration. Therefore if it appears to be a common request and attainable enhancement, you may see it included in a future version of the product.

All the best,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Curtis
Top achievements
Rank 1
answered on 23 Feb 2012, 08:33 PM
I second this request. When binding to a NumericTextBox like the above example in a RadGrid, you get an error when you call item.UpdateValues(entity) later if you have a numeric property that doesn't allow nulls. The default value of the NumericTextBox should return 0 and not null.
0
Radoslav
Telerik team
answered on 28 Feb 2012, 10:15 AM
Hi Curtis,

Unfortunately we do not have plans for such functionality. If we set the default value of NumericTextBox to be 0 then when you bind the NumericTextBox to a database field and this field contains NULL the exception will be thrown. If we tried to convert NULL to 0 in such cases then you could not differentiates fields into database which has 0 from these with NULL. In this case the NumericTextBox will be populated with 0.

All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Brian
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Curtis
Top achievements
Rank 1
Share this question
or