Finding RadComboBox CheckBoxes Controls in RadGrid

6 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    3 posts
    Member since:
    Aug 2013

    Posted 07 Sep 2020 Link to this post

     

    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 ?

     

     

  2. Attila Antal
    Admin
    Attila Antal avatar
    590 posts

    Posted 07 Sep 2020 Link to this post

    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/.

  3. Muhammad
    Muhammad avatar
    3 posts
    Member since:
    Aug 2013

    Posted 07 Sep 2020 in reply to Attila Antal Link to this post

    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;

    }

  4. Attila Antal
    Admin
    Attila Antal avatar
    590 posts

    Posted 10 Sep 2020 Link to this post

    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).

  5. Muhammad
    Muhammad avatar
    3 posts
    Member since:
    Aug 2013

    Posted 21 Sep 2020 Link to this post

    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.

  6. Attila Antal
    Admin
    Attila Antal avatar
    590 posts

    Posted 23 Sep 2020 Link to this post

    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/.

Back to Top