Completed
Last Updated: 06 Oct 2015 14:56 by ADMIN
ADMIN
Danail Vasilev
Created on: 28 Sep 2015 12:48
Category: FormDecorator
Type: Bug Report
0
Integration of RadFormDecorator and RadGrid with GridDateTimeColumn
Issue is reproducible with the code below:

1) Run the code below.

2) Click on "Postback" button or select an item from the dropdown.

3) A sever-side error is thrown - "Collection was modified; enumeration operation may not execute."

ASPX:

    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadButton ID="RadButton1" runat="server" Text="Postback" />

        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All"></telerik:RadFormDecorator>

        <telerik:RadDropDownList ID="cbListeLigue" DataSourceID="DetailsViewDataSource" DefaultMessage="Choisir une ligue" runat="server" AutoPostBack="True" DataTextField="CustomerID" DataValueField="CustomerID" Text="Ligue"></telerik:RadDropDownList>

        <asp:SqlDataSource runat="server" ID="DetailsViewDataSource" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
            OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" />

        <asp:SqlDataSource runat="server" ID="FormViewDataSource" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT [OrderID], [CustomerID], [EmployeeID],[OrderDate] FROM [Orders] WHERE ([CustomerID] = @CustomerID)"
            OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
            <SelectParameters>
                <asp:ControlParameter ControlID="cbListeLigue" Name="CustomerID" PropertyName="SelectedValue"
                    Type="String"></asp:ControlParameter>
            </SelectParameters>
        </asp:SqlDataSource>

        <telerik:RadGrid ID="rGrid_ListeSaison" runat="server"
            DataSourceID="FormViewDataSource" AllowFilteringByColumn="True">
            <MasterTableView DataKeyNames="CustomerID" AutoGenerateColumns="false"
                DataSourceID="FormViewDataSource">
                <Columns>
                    <telerik:GridDateTimeColumn DataField="OrderDate" UniqueName="OrderDate">
                    </telerik:GridDateTimeColumn>
                    <%--<telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID"></telerik:GridBoundColumn>--%>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </form>

You can choose one of the following workarounds:

1) Set the ControlsToSkip="GridFormDetailsViews,LoginControls,ValidationSummary"  property of the decorator.

2) Set the AllowFilteringByColumn property of the grid to false.

3) Remove the GridDateTimeColumn column of the grid.
0 comments