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

How Allow null value in Radgrid batchedit mode

1 Answer 259 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 23 Nov 2015, 06:44 PM

When the user empties a value a numeric text box, the grid doesn't save changes and the changed field stays with a red dot in the corner.

In this scenario I would like the row to be saved with a null value for the numeric field. Is that possible?

 

<telerik:RadGrid
            ID="RadGrid1"
            runat="server"
            AutoGenerateColumns="False"
            CssClass="grid"
            GroupPanelPosition="Top" Skin="Silk"
            AllowFilteringByColumn="True" AlternatingItemStyle-Wrap="False" AlternatingItemStyle-BackColor="#B8B1B4" ItemStyle-Wrap="false"
            AllowSorting="True" Height="650px" Width="100%" AllowPaging="True" PageSize="2000" AutoGenerateDeleteColumn="True" DataSourceID="LinqYonisLogs" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" OnBatchEditCommand="RadGrid1_BatchEditCommand">

<AlternatingItemStyle Wrap="False" BackColor="#B8B1B4"></AlternatingItemStyle>

        <MasterTableView DataSourceID="LinqYonisLogs" CommandItemDisplay="TopAndBottom" DataKeyNames="CustomerCode, MQS_Code" EditMode="Batch">
            <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
            <Columns>
                <telerik:GridBoundColumn DataField="CustomerCode" ReadOnly="true" FilterControlAltText="Filter CustomerCode column" HeaderText="Customer Code" SortExpression="CustomerCode" UniqueName="CustomerCode">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="MQS_Code" ReadOnly="true" FilterControlWidth="55px" FilterControlAltText="Filter MQS_Code column" HeaderText="MQS Code" SortExpression="MQS_Code" UniqueName="MQS_Code">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn DataField="QuotedPrice" DataType="System.Decimal" FilterControlAltText="Filter QuotedPrice column" HeaderText="Quoted Price" SortExpression="QuotedPrice" UniqueName="QuotedPrice">
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="rdteQuotedPrice" runat="server" DbValue='<%# Eval("QuotedPrice") %>'>
                            <IncrementSettings InterceptMouseWheel="false" InterceptArrowKeys="false" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="QuotedPriceLabel" runat="server" Text='<%# Eval("QuotedPrice") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="Action" FilterControlAltText="Filter Action column" HeaderText="Action" SortExpression="Action" UniqueName="Action">
                </telerik:GridBoundColumn>

            </Columns>

<PagerStyle AlwaysVisible="True"></PagerStyle>
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="True" AllowKeyboardNavigation="True">
            <KeyboardNavigationSettings AllowActiveRowCycle="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="false" />
            <Resizing AllowColumnResize="True" />
            <Selecting AllowRowSelect="true" />
        </ClientSettings>

<ItemStyle Wrap="False"></ItemStyle>

        <PagerStyle AlwaysVisible="True" />
        </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 25 Nov 2015, 09:05 AM
Hello Boris,

As you could see in the following demo, emptying the UnitsInStock field and clicking on the "Save Changes" button will pass the null value and will save it to the dabase:
The same behavior could be observed with a template column like yours. Can you please confirm that you are clicking on the "Save Changes" button? If so, please examine your browser's console and see if there are any JavaScript errors that could break the functionality of the control.


Best Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Jonathan
Top achievements
Rank 1
Iron
commented on 18 Jan 2023, 07:40 PM

How do you handle nulls with the server side batch editing api?
Konstantin Dikov
Telerik team
commented on 20 Jan 2023, 11:46 AM

Hi Jonathan,

Could you please provide more information about the issue that you are facing? The demo linked in the previous reply is using server-side operations and is handling the null values as expected.

Tags
Grid
Asked by
Boris
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or