default value

3 posts, 0 answers
  1. Kjell
    Kjell avatar
    212 posts
    Member since:
    May 2011

    Posted 15 Sep 2016 Link to this post

    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. Phil H.
    Phil H. avatar
    88 posts
    Member since:
    Nov 2008

    Posted 15 Sep 2016 in reply to Kjell Link to this post

    Hi:

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

    Phil

  3. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1766 posts

    Posted 19 Sep 2016 Link to this post

    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.
Back to Top