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

Batch Edit direct edit without clicking the row or cell

3 Answers 187 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sai
Top achievements
Rank 1
sai asked on 21 Dec 2019, 04:48 AM

Hi,

 

I have same drodown in ItemTemplate and edititemTemplate.iI don't want to  click the cell and edit.If anything i edit in itemtemplate,the cell should be recognised as edited. same way in Edititemtemplate.So i don't want the cell disable.I found one link related to check box.I want same for dropdown also.But it is not working for dropdown 

https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/how-to/editing-checkboxes?_ga=2.38799904.202473376.1576560062-1142414788.1551175497

 

3 Answers, 1 is accepted

Sort by
0
sai
Top achievements
Rank 1
answered on 22 Dec 2019, 11:29 AM

Please help me on this since I need some solution for above requirement.is there any way to achieve 

0
Accepted
Eyup
Telerik team
answered on 25 Dec 2019, 10:23 AM

Hi Sai,

 

You can achieve this requirement using the following approach:

       <telerik:RadGrid ... >
            <ClientSettings>
                <ClientEvents OnBatchEditOpening="batchEditOpening" />
            </ClientSettings>
            <MasterTableView ... >
                <Columns>
                    <telerik:GridTemplateColumn DataField="ShipCountry" HeaderText="Ship Country" UniqueName="ShipCountry">
                        <ItemTemplate>
                            <telerik:RadComboBox ID="RadComboBox1" runat="server" SelectedValue='<%# Eval("ShipCountry") %>'
                                OnClientSelectedIndexChanging="OnClientSelectedIndexChanging" Width="140px">
                                <Items>
                                    <telerik:RadComboBoxItem Text="Country 1" Value="Country 1" />
                                    <telerik:RadComboBoxItem Text="Country 2" Value="Country 2" />
                                    <telerik:RadComboBoxItem Text="Country 3" Value="Country 3" />
                                    <telerik:RadComboBoxItem Text="Country 4" Value="Country 4" />
                                    <telerik:RadComboBoxItem Text="Country 5" Value="Country 5" />
                                </Items>
                            </telerik:RadComboBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:HiddenField runat="server" ID="HiddenField1" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
JS:
            function batchEditOpening(sender, args) {
                if (args.get_columnUniqueName() == "ShipCountry" && window.event) {
                    args.set_cancel(true);
                }
            }
            function OnClientSelectedIndexChanging(sender, args) {
                if (window.event) {
                    args.set_cancel(true);
                    var grid = $find("<%= RadGrid1.ClientID %>");
                    var masterTableView = grid.get_masterTableView();
                    var batchEditingManager = grid.get_batchEditingManager();
                    var parentCell = $telerik.$(sender.get_element()).parents("td")[0];
                    var newValue = args.get_item().get_value();
                    setTimeout(function () {
                        batchEditingManager.changeCellValue(parentCell, newValue);
                    });
                }
            }
I hope this will prove helpful.

 

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
sai
Top achievements
Rank 1
answered on 13 Feb 2020, 05:35 AM
it works fine for me thank you
Tags
General Discussions
Asked by
sai
Top achievements
Rank 1
Answers by
sai
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or