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

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

4 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 17 Nov 2019, 02:49 PM

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" >
           
            <tr>
                <td>
                    <telerik:RadGrid ID="rgRegEntity" runat="server" AllowSorting="True" AllowPaging="True" 
                        RenderMode="Lightweight" AllowAutomaticInserts="True" AutoGenerateColumns="False" AllowAutomaticUpdates="True"
                        DataSourceID="SqlDataSource1"  OnItemDeleted="rgRegEntity_ItemDeleted" 
                        AllowAutomaticDeletes="True">
                        <MasterTableView DataKeyNames="RegistrationFundingSourceUID" ClientDataKeyNames="RegistrationFundingSourceUID"
                            DataSourceID="SqlDataSource1" 
                            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" />

                            <Columns>
                                 <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:GridButtonColumn>
                                <telerik:GridBoundColumn DataField="RegistrationUID" HeaderStyle-Width="3%" HeaderText="RegistrationUID" SortExpression="RegistrationUID"
                                    UniqueName="RegistrationUID" Visible="false">                                    
                                </telerik:GridBoundColumn>

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

        <hr id="hrLine" class="line-Style-Separator" />
        <div width="100" STYLE="text-align:left;"> 
            <asp:Label runat="server" ID="lblLastModifiedBy" STYLE="text-align:left;" />
        </div>
        <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:Panel>
</telerik:RadAjaxPanel>

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

       SelectCommand="SELECT 
       distinct  [RegistrationUID]
      ,[RegistrationFundingSourceUID]      
      ,[CPFundingsId]
      ,[fundingsourcename]   
      ,[EntityTypeUID]       
      ,[EntityId]
      ,[EntityType]
      ,[SecondaryContractor]
        FROM vwRegistrationLineltems WHERE (RegistrationUID  = @RegistrationUID)"
DeleteCommand="DELETE FROM [tblRegistrationFundingSources] WHERE [RegistrationFundingSourceUID]= @RegistrationFundingSourceUID"
    >   
    <SelectParameters>
        <asp:QueryStringParameter Name="RegistrationUID" Type="Int32" QueryStringField="RegistrationUID" />        
    </SelectParameters>
    <DeleteParameters>
            <asp:Parameter Name="RegistrationFundingSourceUID" Type="Int32"></asp:Parameter>
    </DeleteParameters>
</asp:SqlDataSource>

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

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

4 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 18 Nov 2019, 01:34 AM

Aslo..it 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?

0
Attila Antal
Telerik team
answered on 20 Nov 2019, 05:19 PM

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.
0
Robert
Top achievements
Rank 1
answered on 15 Jan 2020, 10:18 PM

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

 

0
Robert
Top achievements
Rank 1
answered on 15 Jan 2020, 10:20 PM

Issue Fixed  … When I Replaced RadDropDownList with RadCombobox.

Thanks for the help though.

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