My grid is in EditMode="Batch" and RadDropDownTree in GridTemplateColumn behaves funky.
Am i missing anything?
Thank you
David
Attila Antal
Telerik team
commented on 03 May 2023, 03:32 PM
Hi David,
Could you please elaborate? For instance, you could tell us what you are trying to do, what is expected, and what is actually happening.
You could also share the code used to implement the Grid so we can have a better overview of its structure. If it's only behavior, capture the screen while interacting with the Grid.
Any information would help us get closer to the problem so we can share a solution for it.
Thank you for sharing the Grid's markup code. I can now understand why it would behave differently than usual. The EditMode is set to Batch, which is a Client-Side (JavaScript-based) editing functionality and has to be treated in another way. Here is an article explaining the specifics: RadGrid Batch Editing Templates and Specifics
Having that in mind, you will have to work with the components using their Client-Side APIs.
Generally speaking, BatchEditing can understand simple components such as TextBoxes and DropDownLists. It can extract the text and value of those components automatically when needed. The RadDropDownTree is much more complex, and you will need to take over and handle the Values manually. By that I mean, that you will need to subscribe to the BatchEdit Client-Side events (OnBatchEditGetCellValue, OnBatchEditSetCellValue, OnBatchEditGetEditorValue, OnBatchEditSetEditorValue), and write a JavaScript code that will get and set the values accordingly.
There aren't examples specifically for the DropDownTree that we can share, however, you can check out the following Knowledge Base articles that demonstrate different scenarios using Batch Editing:
Hi David,
Could you please elaborate? For instance, you could tell us what you are trying to do, what is expected, and what is actually happening.
You could also share the code used to implement the Grid so we can have a better overview of its structure. If it's only behavior, capture the screen while interacting with the Grid.
Any information would help us get closer to the problem so we can share a solution for it.
Hi Atilla,
RadDropDownList in my grid performs perfectly, however RadDropDownTree opens outside of cell and does not set selected value in the cell.
<telerik:RadGrid RenderMode="Lightweight" ID="grdMain" GridLines="None" runat="server" style="outline:none;"
AllowAutomaticDeletes="True" AllowAutomaticUpdates="True" AllowPaging="True"
AllowAutomaticInserts="True" PageSize="10" AutoGenerateColumns="False"
OnNeedDataSource="grdMain_OnNeedDataSource"
PreRender = "grdMain_PreRender"
OnBatchEditCommand="grdMain_BatchEditCommand"
onclick="gridFocus(event)">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="RecordID"
HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
<BatchEditingSettings EditType="Cell" HighlightDeletedRows="true"/>
<Columns>
<telerik:GridBoundColumn DataField="RecordID" Visible="false"/>
<telerik:GridTemplateColumn DataField="RegionID" HeaderText="Region" UniqueName="RegionID">
<ItemTemplate>
<%# Eval("RegionName") %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList ID="Regions" Width="300px" runat="server" DataTextField="RegionName" DataValueField="RegionID"/>
</EditItemTemplate>
<HeaderStyle Width="300px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Sector" UniqueName="Sector">
<ItemTemplate>
<%# Eval("SectorDescription") %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownTree ID="Sectors"
runat="server"
DataFieldParentID="ParentID" DataFieldID="ID"
DataTextField="Alias" DataValueField="ID">
<DropDownSettings OpenDropDownOnLoad="false" />
</telerik:RadDropDownTree>
</EditItemTemplate>
<HeaderStyle Width="370px" />
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
Thank you<ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
</telerik:RadGrid>
Hi David,
Thank you for sharing the Grid's markup code. I can now understand why it would behave differently than usual. The EditMode is set to Batch, which is a Client-Side (JavaScript-based) editing functionality and has to be treated in another way. Here is an article explaining the specifics: RadGrid Batch Editing Templates and Specifics
Having that in mind, you will have to work with the components using their Client-Side APIs.
RadDropDownTree Client-Side API Documentations:
Generally speaking, BatchEditing can understand simple components such as TextBoxes and DropDownLists. It can extract the text and value of those components automatically when needed. The RadDropDownTree is much more complex, and you will need to take over and handle the Values manually. By that I mean, that you will need to subscribe to the BatchEdit Client-Side events (OnBatchEditGetCellValue, OnBatchEditSetCellValue, OnBatchEditGetEditorValue, OnBatchEditSetEditorValue), and write a JavaScript code that will get and set the values accordingly.
There aren't examples specifically for the DropDownTree that we can share, however, you can check out the following Knowledge Base articles that demonstrate different scenarios using Batch Editing:
I hope this will prove helpful.