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

default value

2 Answers 195 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Iron
Iron
Kjell asked on 15 Sep 2016, 01:49 PM

I use EditItemTemplate and RadNumericTextBox.

How set default value to 100 into the RadNumericTextBox if the user does not fill in the value?

 

<telerik:GridTemplateColumn UniqueName="sortid" SortExpression="sortid" HeaderText="Sortering" EditFormHeaderTextFormat="" HeaderStyle-Width="100px">
    <ItemTemplate>
        <asp:Label ID="lblSortid" Text='<%# Eval("sortid") %>' runat="server" />
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadNumericTextBox ID="tbSortid" Width="100px" MaxLength="3" Text='<%# Bind("sortid") %>' EmptyMessage="Sortering (100)" ToolTip="Sortering" runat="server">
            <NumberFormat DecimalDigits="0" GroupSeparator="" />
        </telerik:RadNumericTextBox>
        <asp:RequiredFieldValidator
            ID="rfvSortid"
            ControlToValidate="tbSortid"
            Display="Dynamic"
            ErrorMessage="Sortering (100)?"
            ForeColor="#FF0000"
            SetFocusOnError="true"
            runat="server" />
    </EditItemTemplate>
</telerik:GridTemplateColumn>

2 Answers, 1 is accepted

Sort by
0
Phil H.
Top achievements
Rank 2
answered on 15 Sep 2016, 05:43 PM

Hi:

Try onblur clientside event.  If the sender (RadNumericTextbox) get_value() is empty then set it.

Phil

0
Viktor Tachev
Telerik team
answered on 19 Sep 2016, 08:21 AM
Hello,

If you would like to specify a default value that will be inserted by default for the field you can use the DefaultInsertValue property for the column.

Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Kjell
Top achievements
Rank 1
Iron
Iron
Answers by
Phil H.
Top achievements
Rank 2
Viktor Tachev
Telerik team
Share this question
or