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

BatchEdit not working properly for Autopostback=True

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Swapnil
Top achievements
Rank 1
Swapnil asked on 30 Jun 2015, 09:54 AM

Hi,

I am doing BatchEdit for Nesting grid with template control in RadGrid. I have some postback event for control in template columns, but if I set AutoPostback="True"  for control and when I click on on any row for edit current clicked row gets lost and when I again click on row same row it open as usual.

Below is my code snippet

<telerik:RadGrid ID="VarianceMgmntGrid" runat="server" ShowStatusBar="true" AutoGenerateColumns="False"
                        PageSize="7" AllowSorting="false" AllowMultiRowSelection="False" AllowPaging="True"
                        OnDetailTableDataBind="VarianceMgmntGrid_DetailTableDataBind" OnNeedDataSource="VarianceMgmntGrid_NeedDataSource" OnBatchEditCommand="VarianceMgmntGrid_BatchEditCommand" OnItemUpdated="VarianceMgmntGrid_ItemUpdated">
                       <ClientSettings AllowExpandCollapse="true">
                        </ClientSettings>
                        <MasterTableView DataKeyNames="ReconTypeID,InstrumentTypeId" AutoGenerateColumns="False" ShowFooter="true" ShowHeader="true">
                            <DetailTables>
                                <telerik:GridTableView DataKeyNames="ReconTypeID,VarReasonCodeID,InstrumentTypeId" Name="ProductType" Width="100%">
                                    <DetailTables>
                                        <telerik:GridTableView DataKeyNames="ReconTypeID,VarReasonCodeID,InstrumentTypeId,OTCVarId" Name="ReasonCodeProduct" Width="100%">
                                            <DetailTables>
                                                <telerik:GridTableView EditMode="Batch" DataKeyNames="OTCVarId,VarReasonCodeID,ReconTypeID,InstrumentTypeId" Name="ReasonCodeDetailsProduct" Width="100%" CommandItemDisplay="Top" EditMode="Batch" EditFormSettings-EditColumn-AutoPostBackOnFilter="false"  AutoGenerateColumns="False" HorizontalAlign="NotSet" AllowAutomaticInserts="True">
                                                    <BatchEditingSettings EditType="Row" />
                                                    <Columns>
                                                        <telerik:GridTemplateColumn DataField="BrokerValue" UniqueName="BrokerValue" HeaderText="Broker"
                                                            HeaderStyle-Width="90px">
                                                            <ItemTemplate>

                                                                <asp:Label ID="lblBrokerInner" runat="server" Text='<%# LibFMA.Functions.FormatCurrency(Eval("BrokerValue"), True, 2)%>'></asp:Label>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <telerik:RadTextBox ID="txtBrokerInner" runat="server" Width="110px AutoPostBack="true" OnTextChanged="BrokerValue_TextChanged" 
                                                                    CssClass="RightAligned">
                                                                </telerik:RadTextBox>
                                                            </EditItemTemplate>
                                                            <HeaderStyle CssClass="OTCs_gridHeader_left" HorizontalAlign="Left" Font-Bold="true"
                                                                ForeColor="WhiteSmoke" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn DataField="SystemValue" UniqueName="SystemValue" HeaderText="System"
                                                            HeaderStyle-Width="90px">
                                                            <ItemTemplate>
                                                                <asp:Label ID="lblSystemInner" runat="server" Text='<%# LibFMA.Functions.FormatCurrency(Eval("SystemValue"), True, 2)%>'></asp:Label>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <telerik:RadTextBox ID="txtSystemInner" runat="server" Width="110px" AutoPostBack="true" OnTextChanged="BrokerValue_TextChanged" 
                                                                    CssClass="RightAligned">
                                                                </telerik:RadTextBox>
                                                            </EditItemTemplate>
                                                            <HeaderStyle CssClass="OTCs_gridHeader_left" HorizontalAlign="Left" Font-Bold="true"
                                                                ForeColor="WhiteSmoke" />
                                                        </telerik:GridTemplateColumn>

 Please do the needful for same.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 30 Jun 2015, 01:27 PM
Hello Swapnil,

The Batch Editing is a client-side oriented edit mode and it is not supported scenario to have controls within it that will initiate a postback. 

As for the cause of the behavior in question, this is due to the fact that there will be only one editor generated for the entire column and once you open a cell for editing, the internal logic of the Batch Editing will retrieve the cell value and will set it to the editor. This will fire the OnTextChanged event and will initiate a postback. After the postback, since the editor will already contain the cell value, when you open the same cell, the OnTextChanged event will not fire.

With all that in mind, if handling the OnTextChanged event is mandatory for your scenario, the only valid option that you have is to change the edit mode to one of the server-side oriented modes.

Hope this helps.


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
Tags
Grid
Asked by
Swapnil
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or