New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Set Default Insert Value When Adding New Records in RadGrid

Description

When the user creates new records in RadGrid, you may want to present them with pre-set default values to make it more convenient to fill up the form.

Solution

For most of the data-type columns like GridBoundColumn, GridNumericColumn, etc., you can set the DefaultInsertValue property:

<telerik:GridNumericColumn ... DefaultInsertValue="0">

The alternative approach is to access the generated edit controls and set their initial value manually:

Accessing Controls in Edit/Insert Mode

You can use the approach demonstrated here to determine whether the item is in edit or insert mode:

Distinguish Edit or Insert Mode

The alternative approach for Batch editing is different since this mode is different than other server-side based modes:

Accessing Controls in Batch Edit Mode

Therefore, with Batch editing you can use the following event handler to achieve this requirement by accessing the generated controls on client-side using jQuery:

OnBatchEditOpened

In this article
Not finding the help you need? Improve this article