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

RadGrid posting back on EditCommand and painfully slow!!!

3 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 09 May 2013, 04:54 AM
Hi Guys,

This is my RadGrid:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" DataSourceID="SqlDataSource1" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" CellSpacing="0" GridLines="None">
        <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="ID" CommandItemDisplay="TopAndBottom">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="imagebutton" />
                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Client_Name" FilterControlAltText="Filter Client_Name column" HeaderText="CLIENT_NAME" SortExpression="Client_Name" UniqueName="Client_Name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Equipment" FilterControlAltText="Filter Equipment column" HeaderText="EQUIPMENT" SortExpression="Equipment" UniqueName="Equipment">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Serial_Number" FilterControlAltText="Filter Serial_Number column" HeaderText="SERIAL_NUMBER" SortExpression="Serial_Number" UniqueName="Serial_Number">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Reason" FilterControlAltText="Filter Reason column" HeaderText="REASON" SortExpression="Reason" UniqueName="Reason">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn UniqueName="ButtonColumn" Text="Delete" CommandName="Delete" ButtonType="imagebutton" />
            </Columns>
            <EditFormSettings>
                <EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1" CancelText="Cancel">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
    </telerik:RadGrid>

And this is my datasource:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:ClarityConnectionString %>" 
        OldValuesParameterFormatString="original_{0}" 
        DeleteCommand="DELETE FROM invClientsEquipmentInOffice WHERE (ID = @original_ID)" 
        InsertCommand="INSERT INTO invClientsEquipmentInOffice(Client_Name, Equipment, Serial_Number, Reason) VALUES (@Client_Name,@Equipment,@Serial_Number,@Reason)" 
        SelectCommand="SELECT ID, Client_Name, Equipment, Serial_Number, Reason FROM invClientsEquipmentInOffice" 
        UpdateCommand="UPDATE invClientsEquipmentInOffice SET Client_Name = @Client_Name, Equipment = @Equipment, Serial_Number = @Serial_Number, Reason = @Reason where ID = @original_ID">
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Client_Name" Type="String" />
            <asp:Parameter Name="Equipment" Type="String" />
            <asp:Parameter Name="Serial_Number" Type="String" />
            <asp:Parameter Name="Reason" Type="String" />
            <asp:Parameter Name="original_ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Client_Name" Type="String" />
            <asp:Parameter Name="Equipment" Type="String" />
            <asp:Parameter Name="Serial_Number" Type="String" />
            <asp:Parameter Name="Reason" Type="String" />
        </InsertParameters>
        </asp:SqlDataSource>

There is nothing in the code behind.

Partial Class inventory
    Inherits System.Web.UI.Page

End Class

Ok. The problem is that when you click the edit icon on any Row the entire page posts back and is painfully slow. Is there any way to prevent this postback?

Is there any built in default AJAX functionality for CRUD operations? One would think that by default when you click the edit icon that everything would happen client side as all the information is in the row you just clicked?

How do I find out what is happening when this postback occurs? Is it rebinding to the datasource every time I wonder?

Note: It should be noted that this is the "out of the box" RagGrid, I have not written any custom code for this one it was entirely created in Design View.

Note: It should also be noted that the select query return only 35 rows and runs in SSMS in 00:00:00 time.



3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 May 2013, 05:07 AM
Hi,

Please try Ajaxifying the RadGrid as in this demo.


Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 09 May 2013, 05:23 AM
Thanks Princy

It is still slow but at least it is not posting back anymore.
If I Ajaxify a grid with one or two rows it runs very quickly however the bigger the grid the slower the ajax performance.
Why is this?
Can I optimize the ajax code in any way? 
0
Princy
Top achievements
Rank 2
answered on 10 May 2013, 05:34 AM
Hi,

One suggestion is to use Virtual scrolling/Paging for really huge data sets are used to populate RadGrid.

Thanks,
Princy.
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Share this question
or