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

Accessing an EditItemTemplate control in a GridTemplateColumn in a Grid with EditMode="Batch"

1 Answer 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joseph S.
Top achievements
Rank 1
Joseph S. asked on 28 Nov 2014, 06:38 PM
Hello,
I need to find at server side an EditItemTemplate control in a GridTemplateColumn when the data are loaded in a Grid.
The Grid EditMode is set to "Batch":
<MasterTableView GridLines="None" HorizontalAlign="NotSet" CommandItemDisplay="Top"
   EditMode="Batch" AutoGenerateColumns="False" AllowNaturalSort="false">
   <Columns>
                                                 
...............
                                                 
<telerik:GridTemplateColumn HeaderText="Values" UniqueName="Values" DataField="Values">
    <HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center"></ItemStyle>
    <ItemTemplate>
        <%#Eval("Values")%>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadComboBox ID="cbxMyValues" runat="server" Width="80px" AllowCustomText="true" MarkFirstMatch="true" AutoCompleteSeparator=";">
        </telerik:RadComboBox>
    </EditItemTemplate>
</telerik:GridTemplateColumn>
..................
 </Columns>
</MasterTableView>
  
I need to reference the "cbxMyValues" RadComboBox control.
When the ItemDataBound event is fired this code doesn't work because the type of e.Item is "GridDataItem".:
If (TypeOf (e.Item) Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then
    Dim lgeiCurrent As GridEditableItem = CType(e.Item, GridEditableItem)
    Dim lobjRadComboBox As RadComboBox  = lgeiCurrent.FindControl("cbxMyValues")
End If

Please how can I get the RadComboBox object?
Thank you.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Dec 2014, 10:54 AM
Hi Joseph,

Thank you for contacting us.

Please note that Batch editing is mainly a client-side functionality and in this sense, it is a better idea to implement javascript approaches in this case. For example, there are not 10 different combos generated to edit each of the records as with EditForms or PopUp edit modes, but there is only 1 combo loaded on the server which works for ideal performance and rendering optimization when opening the edit cells on the client. In addition, creating custom edit templates with Batch editing mode may require further handling:
(Section Handling Advanced Templates)
http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html

With that being said,
you can check the aforementioned article to see how to access the editors programmatically.

Hope this helps. Please let us know if you need further assistance.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Joseph S.
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or