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

Grid Batch Edit Mode

1 Answer 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 17 Sep 2013, 09:55 AM
Hello All,

I am using a grid with batch edit mode and I am unable to find/bind a RadComboBox in an EditItemTemplate. I have tried itemdatabound and prerender and neither seem to work.

Any advice one where it should be bound and how to find it would be greatly appreciated.

Thanks, Paul.

<telerik:GridTemplateColumn HeaderText="Job" HeaderStyle-Width="180px" UniqueName="Job" DataField="jobid">
                            <ItemTemplate>
                                <%# Eval("jobnumber") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="rcbJobID" runat="server" EmptyMessage="Select a Job." CausesValidation="false" Width="90px"
                                    HighlightTemplatedItems="true" DropDownWidth="350px" DataValueField='<%# Eval("jobid") %>'>
                                    <HeaderTemplate>
                                        <table style="width: 320px;" class="dropdownheader">
                                            <tr>
                                                <td style="width: 150px;">Job #
                                                </td>
                                                <td style="width: 170px">Job Name
                                                </td>
                                            </tr>
                                        </table>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <table style="width: 320px;">
                                            <tr>
                                                <td style="width: 150px">
                                                    <%# DataBinder.Eval(Container, "Text")%>
                                                </td>
                                                <td style="width: 170px; text-align: left;">
                                                    <%# DataBinder.Eval(Container, "Attributes['Description']")%>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 20 Sep 2013, 07:32 AM
Hello Paul,

There are a two things which you should bare in mind when using the batch editing functionality.
  1. Bind expressions are not allowed in the EditItemTemplate. The mode is designed in such way that it will automatically populate the first input element with the appropriate value from the cell. When more than one input element will be present in the template things should be handled manually like demonstrated in this help article.
  2. Only one editor is initialized for every column. This is done for optimization purposes. In reality RadGrid creates an editable item which is not visible. Once a cell is opened for edit the respective editor is displayed over the clicked cell. If another cell from the same column is clicked the editor will be reused. All the editors are rendered in a hidden panel and for obtaining a reference to the RadComboBox in the particular example you can use the code shown below(executed in the PreRender):
    RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID + "_Job").FindControl("rcbJobID")
Additionally for you convenience I have assembled a sample website which demonstrates how to modify the column definition.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or