Grid - Batch Editing - on edit mode Radcombobox is loosing its existing selected value

5 posts, 0 answers
  1. Robert
    Robert avatar
    12 posts
    Member since:
    Jan 2012

    Posted 17 Nov 2019 Link to this post

    Hello Guys,

    Long time TELERIK fan.. but my first Post..  

    I am banging my head for the past 2 days in figuring out the issue.

    Below is my RadGrid for Bulk Edit/Update.  All the CRUD operations works with a minor issue. 

    I have two radcomboboxs "cmbFundingSrc" & "cmbEntityType". When i click the row to edit values..

    RadCombobox "cmbFundingSrc" will loose the selected value BUT other RadCombobox "cmbEntityType" will retain & show the existing selected value.

    What could be the issue? Kindly let me know

    <%@ Register assembly="Telerik.Web.UI, Version=2018.1.117.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <telerik:RadFormDecorator ID="FormDecorator1" runat="server" />

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" RenderMode="Inline">
        <asp:Panel runat="server" ID="pnlLineItemFormAdd" >     
                    <br />
            <table cellpadding="4" cellspacing="2"  border="1" width="100%" style="table-layout:fixed" class="detail-SubTable" >
                        <telerik:RadGrid ID="rgRegEntity" runat="server" AllowSorting="True" AllowPaging="True" 
                            RenderMode="Lightweight" AllowAutomaticInserts="True" AutoGenerateColumns="False" AllowAutomaticUpdates="True"
                            DataSourceID="SqlDataSource1"  OnItemDeleted="rgRegEntity_ItemDeleted" 
                            <MasterTableView DataKeyNames="RegistrationFundingSourceUID" ClientDataKeyNames="RegistrationFundingSourceUID"
                                NoMasterRecordsText="No Records to display." Width="100%" TableLayout="Auto" ShowHeadersWhenNoRecords="true" 
                                EditMode="Batch" CommandItemDisplay="TopAndBottom">

                                <BatchEditingSettings EditType="Row" SaveAllHierarchyLevels="true" OpenEditingEvent="Click"/>

                                <CommandItemSettings ShowSaveChangesButton="true" ShowCancelChangesButton="true" />

                                     <telerik:GridButtonColumn ConfirmText="Delete this LineItem?" ConfirmDialogType="RadWindow"
                                        ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="3%"  ItemStyle-Width="50px"
                                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                    <telerik:GridBoundColumn DataField="RegistrationUID" HeaderStyle-Width="3%" HeaderText="RegistrationUID" SortExpression="RegistrationUID"
                                        UniqueName="RegistrationUID" Visible="false">                                    

                                 <telerik:GridTemplateColumn HeaderText="Funding Source <br />[Reporting Category]" HeaderStyle-Width="14%" UniqueName="CPFundingsId" DataField="CPFundingsId">
                                        <%# Eval("fundingsourcename") %>
                                        <telerik:RadDropDownList RenderMode="Lightweight" DefaultMessage="Select Funding Src" runat="server" ID="cmbFundingSrc" DataValueField="CPFundingsId"
                                            DataTextField="fundingsourcename" DataSourceID="SqlFundingDataSource" DropDownWidth="200px" >
                                        <span style="color: Red">
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator12"
                                                             ControlToValidate="cmbFundingSrc" ErrorMessage="*Required" runat="server" Display="Dynamic">
                                  <telerik:GridTemplateColumn HeaderText="Document <br />Type" HeaderStyle-Width="7%" UniqueName="EntityTypeUID" DataField="EntityTypeUID">
                                        <%# Eval("EntityType") %>
                                        <telerik:RadDropDownList RenderMode="Lightweight" runat="server" DefaultMessage="Select Document Type" ID="cmbEntityType" DataValueField="EntityTypeUID"
                                            DataTextField="EntityType" DataSourceID="SqlEntityTpeMstDataSource" DropDownWidth="200px">
                                        <span style="color: Red">
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9"
                                                        ControlToValidate="cmbEntityType" ErrorMessage="*Required" runat="server" Display="Dynamic">
                            <ClientSettings AllowExpandCollapse="true">
                                <Selecting AllowRowSelect="true"   />
                                <Scrolling AllowScroll="True" ScrollHeight="255" UseStaticHeaders="true" />

            <hr id="hrLine" class="line-Style-Separator" />
            <div width="100" STYLE="text-align:left;"> 
                <asp:Label runat="server" ID="lblLastModifiedBy" STYLE="text-align:left;" />
            <asp:TextBox runat="server" ID="txtRegID" visible="false"></asp:TextBox>
            <asp:TextBox runat="server" ID="txtPrimeContractorID" visible="false"></asp:TextBox>        
            <asp:TextBox runat="server" ID="txtLoggedInUserID" visible="false"></asp:TextBox>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Budget2013ConnectionString %>"

           distinct  [RegistrationUID]
            FROM vwRegistrationLineltems WHERE (RegistrationUID  = @RegistrationUID)"
    DeleteCommand="DELETE FROM [tblRegistrationFundingSources] WHERE [RegistrationFundingSourceUID]= @RegistrationFundingSourceUID"
            <asp:QueryStringParameter Name="RegistrationUID" Type="Int32" QueryStringField="RegistrationUID" />        
                <asp:Parameter Name="RegistrationFundingSourceUID" Type="Int32"></asp:Parameter>

    <asp:SqlDataSource ID="SqlEntityTpeMstDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:Budget2013ConnectionString %>"
        SelectCommand=" SELECT [EntityTypeUID],[EntityType]  FROM [Budget2013].[Lookups].[tblEntityTypeMst]">
    <asp:SqlDataSource ID="SqlFundingDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:Budget2013ConnectionString %>"
        SelectCommand="SELECT DISTINCT [CPFundingsId] ,[fundingsourcename] FROM [Budget2013].[dbo].[vwRegistrationCPListWithFundingInfo] " 

             <asp:QueryStringParameter Name="RegistrationUID" Type="Int32" QueryStringField="RegistrationUID" />        

  2. Robert
    Robert avatar
    12 posts
    Member since:
    Jan 2012

    Posted 17 Nov 2019 Link to this post works perfectly fine in Chrome.

    IE 11 doesn't work

    Does RenderMode play a role in my issue ? Or any other JavaScript or css I should be aware off?

  3. Attila Antal
    Attila Antal avatar
    590 posts

    Posted 20 Nov 2019 Link to this post

    Hi Robert,

    The main purpose of the RenderModes are to rendered a different structure and Style-sheets for the controls, and they are mainly affecting the visual appearance or behavior. 

    About the issue, I believe it has something to do with the data source bound to the DropDownList versus the data source bound to the Grid. We've experienced a similar issue, if a ComboBox or DropDownList has multiple values of the same type, then no item will be selected.

    You can try isolating the issue by trying the steps below:

    Remove all columns except the one with the issue.

    Try setting both the DataValueField and DataTextField properties of the DropDownList to be the same, as "fundingsourcename"

    Try replacing the RadDropDownList with an ASP DropDownList and confirm the same issue happens. Of course you will also need to change the SelectCommand in the SqlDataSource control. Try something like "SELECT DISTINCT [fundingsourcename] FROM [Budget2013].[dbo].[vwRegistrationCPListWithFundingInfo]"

    Extract the DISTINCT values of fundingsourcename column from the "vwRegistrationLineltems" table and compare that to the DISCTINCT values of fundingsourcename column in the "vwRegistrationCPListWithFundingInfo" table. Check if the vwRegistrationLineltems Table has some fundingsourcename values that the "vwRegistrationCPListWithFundingInfo" does not. Since the Grid is trying to find and select a DropDownList item by the text property, which might not exist in the DropDownList's data source, in that case it will not select anything.

    You can find attached a sample project which uses a DataTable with dummy data to test this scenario. It would be very helpful if you could modify this sample to produce the error and send it back to us. We can then see what is causing the issue and help resolve it.

    Kind regards,
    Attila Antal
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  4. Robert
    Robert avatar
    12 posts
    Member since:
    Jan 2012

    Posted 15 Jan 2020 in reply to Attila Antal Link to this post

    Sorry for the Late reply. Suggestions were good and made me re-check my values.

    Though the values were distinct in Dropdown and data source bound to the DropDownList versus the data source bound to the Grid have same values …. Problem persists in IE (IE 11).


  5. Robert
    Robert avatar
    12 posts
    Member since:
    Jan 2012

    Posted 15 Jan 2020 Link to this post

    Issue Fixed  … When I Replaced RadDropDownList with RadCombobox.

    Thanks for the help though.

Back to Top