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

Finding RadComboBox CheckBoxes Controls in RadGrid

5 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 07 Sep 2020, 09:10 AM

 

i am using RadGrid BatchEdit, which is using combobox where CheckBoxes="true".  i can't acess checkbox values in server side.

 

telerik:GridTemplateColumn UniqueName="AmountAttributeCategory" HeaderText="Tax"  >
                        <ItemTemplate>
                            <asp:Label runat="server"><%#DataBinder.Eval(Container.DataItem, "TaxesName")%></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>

                           <telerik:RadComboBox   runat="server" ID="RadComboBoxAttribute"  CheckBoxes="true"  AllowCustomText="true"  CheckedItemsTexts="DisplayAllInInput"
                                 OnItemsRequested="RadComboBoxAttribute_ItemsRequested"     
                                EnableLoadOnDemand="true"  DataValueField="TaxesID" DataTextField="Text"   
 >
                             <ItemTemplate>
                                    <table>
                                        <tr>
                                            <td style="width:100px;text-align:left;"><%# DataBinder.Eval(Container, "Text")%></td>
                                             <td style="width:100px;text-align:left;"><%# DataBinder.Eval(Container, "Attributes['Amount']")%></td>  
                                      
                                        </tr>
                                    </table>
                            </ItemTemplate>
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>

 

        protected void RadGrid1_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)
        {

           foreach (GridBatchEditingCommand command in e.Commands)
            {

                        Hashtable oldValues = command.OldValues;
                Hashtable newValues = command.NewValues;

                 //                 GridTemplateColumn file = (GridTemplateColumn)newValues["AmountAttributeCategory"];

               // RadComboBox ddlDesc = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID + "_AmountAttributeCategory").FindControl("RadComboBoxAttribute") as RadComboBox;

}}

 

how to get checkbox values which is binded in combobox RadGrid GridTemplateColumn ?

 

 

5 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 07 Sep 2020, 12:04 PM

Hi Muhammad,

BatchEditing is a client-side functionality of the RadGrid and therefore there is a limitation to accessing controls on server-side. You will need to use the PreRender event of the Grid, that is the only event you can get a reference to the objects, see Accessing Controls in Batch Edit Mode

I would also suggest reviewing the following article that describes a few important aspects of the Batch Editing you may need to know, see RadGrid Batch Editing Templates and Specifics.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Muhammad
Top achievements
Rank 1
answered on 07 Sep 2020, 06:33 PM

Thanks for reply.

Very clear, I want to save all batch records along with GridTemplateColumn Combobox checkboxs values. 

I only have this event RadGrid1_BatchEditCommand option to save my all records. 

 

You have mentioned reference link. Following PreRender event is executed before BatchEditCommand and there is no users data.

protected void RadGrid1_PreRender(object sender, EventArgs e)

{

RadComboBox combo = ((sender as RadGrid).MasterTableView.GetBatchEditorContainer("CategoryID").FindControl("rcbCategory") as RadComboBox); combo.EnableLoadOnDemand = true;

}

0
Attila Antal
Telerik team
answered on 10 Sep 2020, 09:22 AM

Hi Muhammad,

Accessing the data must be done in the BatchEditCommand event. You can find instructions in the Batch Editing Server-side API article.

The PreRender event, where you access the control is only used to Bind data or make changes to the Control that will be available later in Edit mode.

In Batch editing, most of the operation is done on the client-side, but when the user clicks on the save button, all changes will be submitted to the server and that is when the BatchEditCommand kicks in. That is the only event the data will be available on the server.

Regards,
Attila Antal
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Muhammad
Top achievements
Rank 1
answered on 21 Sep 2020, 07:38 AM

Thanks for reply.

i have used custom logic to save combobox checkboxes values in database.

how can i retrieve back in itemtemplate these combbox checkboxes multiple values.

0
Attila Antal
Telerik team
answered on 23 Sep 2020, 10:50 AM

Hi Muhammad,

I have shared a few articles earlier in this Thread. There is one link that will explain how you can access the ComboBox inside the BatchEdit mode. You can then set bind those values back to it if you wish.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Muhammad
Top achievements
Rank 1
Share this question
or