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

Unable to sorting and filtering rad grid

3 Answers 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raghavendra
Top achievements
Rank 1
Raghavendra asked on 05 May 2014, 07:23 AM
when i am trying sorting or filtering on  chrome i am getting script error Uncaught Sys.InvalidOperationException: Sys.InvalidOperationException: A control is already associated with the element. 
and sorting is not happing.
please refer UI design code
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabularData">
                <tr>
                    <td>
                        <telerik:RadTextTile ID="RadTextTile1" runat="server" Text="My WorkList" Width="100%"
                            Height="40px" Font-Size="Medium">
                        </telerik:RadTextTile>
                    </td>
                </tr>
            </table>
            <table style="width: 100%">
                <tr>
                    <td>
                        <asp:Label ID="lblWorkListMsg" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
                            <div id="divWorkList" class="tabularDisplayContainer" runat="server">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" 
                                                AllowSorting="True"
                                                ShowStatusBar="True" AllowFilteringByColumn="True" OnSortCommand="RadGrid1_SortCommand"
                                                AutoGenerateColumns="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                                                 
                                                >
                                                <MasterTableView >
                                                    <Columns>
                                                        <telerik:GridTemplateColumn HeaderText="Reference Number" SortExpression="Folio" AndCurrentFilterValue="true" DataField="Folio"
                                                         AutoPostBackOnFilter="true"  HeaderStyle-Width="20%" ItemStyle-Width="20%">
                                                            <ItemTemplate>
                                                                <asp:HyperLink ID="HyperLink1" NavigateUrl='<%# Eval("Data")%>' Target="_parent"
                                                                    Text='<%# Eval("Folio")%>' runat="server" />
                                                            </ItemTemplate>
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn DataField="RegistrationNumber" HeaderText="Registration Number" AutoPostBackOnFilter="true"
                                                            SortExpression="RegistrationNumber" HeaderStyle-Width="30%" ItemStyle-Width="30%">
                                                            <HeaderStyle Width="30%" />
                                                            <ItemStyle Width="30%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" AutoPostBackOnFilter="true"
                                                            HeaderStyle-Width="20%" ItemStyle-Width="20%">
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" SortExpression="UserID"
                                                            DataFormatString="{0:dd-MMM-yyyy}" HeaderStyle-Width="20%" ItemStyle-Width="20%"
                                                            Visible="false">
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="StartDate" HeaderText="Submitted Date" DataFormatString="{0:dd-MMM-yyyy}"  
                                                            SortExpression="StartDate" HeaderStyle-Width="15%" ItemStyle-Width="15%" AutoPostBackOnFilter="true">
                                                            <HeaderStyle Width="15%" />
                                                            <ItemStyle Width="15%" />
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                    <PagerStyle PageSizeControlType="None" />
                                                </MasterTableView>
                                                <FilterItemStyle ForeColor="#333333" />
                                                <PagerStyle PageSizeControlType="None" />
                                            </telerik:RadGrid>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </telerik:RadAjaxPanel>
                        <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" MinDisplayTime="300">
                        </telerik:RadAjaxLoadingPanel>
                    </td>
                </tr>
            </table>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>






3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 May 2014, 08:05 AM
Hi Raghavendra,

I would suggest you not to nest the RadAjaxPanel in the ASP:UpdatePanel controls. You should use either RadAjaxPanel or ASP:UpdatePanel in order to ajaxify particular page content but not both. Therefore, please try removing the ASP:UpdatePanel and see if the functionality is working fine.

Thanks,
Shinu
0
Raghavendra
Top achievements
Rank 1
answered on 05 May 2014, 08:27 AM
i removed asp.net  updatepanel but still i am facing same problem 

  <div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabularData">
                <tr>
                    <td>
                        <telerik:RadTextTile ID="RadTextTile1" runat="server" Text="My WorkList" Width="100%"
                            Height="40px" Font-Size="Medium">
                        </telerik:RadTextTile>
                    </td>
                </tr>
            </table>
            <table style="width: 100%">
                <tr>
                    <td>
                        <asp:Label ID="lblWorkListMsg" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
                            <div id="divWorkList" class="tabularDisplayContainer" runat="server">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" 
                                                AllowSorting="True"
                                                ShowStatusBar="True" AllowFilteringByColumn="True" OnSortCommand="RadGrid1_SortCommand"
                                                AutoGenerateColumns="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                                                 
                                                >
                                                <MasterTableView >
                                                    <Columns>
                                                        <telerik:GridTemplateColumn HeaderText="Reference Number" SortExpression="Folio" AndCurrentFilterValue="true" DataField="Folio"
                                                         AutoPostBackOnFilter="true"  HeaderStyle-Width="20%" ItemStyle-Width="20%">
                                                            <ItemTemplate>
                                                                <asp:HyperLink ID="HyperLink1" NavigateUrl='<%# Eval("Data")%>' Target="_parent"
                                                                    Text='<%# Eval("Folio")%>' runat="server" />
                                                            </ItemTemplate>
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn DataField="RegistrationNumber" HeaderText="Registration Number" AutoPostBackOnFilter="true"
                                                            SortExpression="RegistrationNumber" HeaderStyle-Width="30%" ItemStyle-Width="30%">
                                                            <HeaderStyle Width="30%" />
                                                            <ItemStyle Width="30%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" AutoPostBackOnFilter="true"
                                                            HeaderStyle-Width="20%" ItemStyle-Width="20%">
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" SortExpression="UserID"
                                                            DataFormatString="{0:dd-MMM-yyyy}" HeaderStyle-Width="20%" ItemStyle-Width="20%"
                                                            Visible="false">
                                                            <HeaderStyle Width="20%" />
                                                            <ItemStyle Width="20%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="StartDate" HeaderText="Submitted Date" DataFormatString="{0:dd-MMM-yyyy}"  
                                                            SortExpression="StartDate" HeaderStyle-Width="15%" ItemStyle-Width="15%" AutoPostBackOnFilter="true">
                                                            <HeaderStyle Width="15%" />
                                                            <ItemStyle Width="15%" />
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                    <PagerStyle PageSizeControlType="None" />
                                                </MasterTableView>
                                                <FilterItemStyle ForeColor="#333333" />
                                                <PagerStyle PageSizeControlType="None" />
                                            </telerik:RadGrid>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </telerik:RadAjaxPanel>
                        <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" MinDisplayTime="300">
                        </telerik:RadAjaxLoadingPanel>
                    </td>
                </tr>
            </table>
        </div>
0
Shinu
Top achievements
Rank 2
answered on 06 May 2014, 05:36 AM
Hi Raghavendra,

This is a general MS AJAX error which is widely discussed on the web as you can see from the search results. If you cannot find what is causing the error, please provide your code behind as well. Could you please try the solution suggested here:
A control is already associated with the element

Thanks,
Shinu
Tags
Grid
Asked by
Raghavendra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Raghavendra
Top achievements
Rank 1
Share this question
or