This is a migrated thread and some comments may be shown as answers.
Slow Filtering and sorting
3 Answers 52 Views
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 1
Kiran asked on 04 Jun 2010, 09:45 PM
Dear Teleriks

I have an issue on filtering(combobox) and sorting on radgrid, even page is not too slow on first time, Please see my code and advise

here is my grid

 

<telerik:RadGrid ID="RadGrid1" Width="100%"

 

 

AllowMultiRowSelection="true" AllowFilteringByColumn="true"

 

 

AutoGenerateColumns="false" CellSpacing="0"

 

 

ClientSettings-Scrolling-ScrollHeight="40%"

 

 

ClientSettings-Scrolling-AllowScroll="true" EnableLinqExpressions="false"

 

 

ClientSettings-Scrolling-UseStaticHeaders="true"

 

 

AllowSorting="True" runat="server">

 

 

<GroupingSettings CaseSensitive="false" />

 

 

 

<MasterTableView TableLayout="Fixed" DataKeyNames="KEYID" ClientDataKeyNames="KEYID" >

 

 

 

<Columns>

 

 

<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="3%" ItemStyle-Width="3%" />

 

 

<telerik:GridNumericColumn Aggregate="Count" DataField="KEYID" HeaderText="KEYID" SortExpression="KEYID"

 

 

UniqueName="KEYID" />

 

 

 

<telerik:GridBoundColumn HeaderText="Employees" DataField="Name" UniqueName="Name" ShowFilterIcon="false"

 

 

HeaderStyle-Width="13%" ItemStyle-Width="13%" SortExpression="Name" AllowFiltering="true"

 

 

AutoPostBackOnFilter="true" FilterControlWidth="80" />

 

 

 

<telerik:GridBoundColumn HeaderText="Pay Period" DataField="Description" UniqueName="Description" ShowFilterIcon="false"

 

 

SortExpression="Description" HeaderStyle-Width="13%" ItemStyle-Width="13%">

 

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxPP" CausesValidation="false" DataSourceID="SqlDataSourcePP" DataTextField="Code" Width="100"

 

 

DataValueField="Code" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Description").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"Description",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</FilterTemplate>

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Department" HeaderStyle-Width="18%" ItemStyle-Width="18%" DataField="Department" UniqueName="Department" ShowFilterIcon="false"

 

 

SortExpression="Department" >

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxDep" CausesValidation="false" DataSourceID="SqlDataSourceDepartment" DataTextField="Department" width="150"

 

 

DataValueField="Department" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged2"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Department").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged2(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"Department",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</FilterTemplate>

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridDateTimeColumn ReadOnly="true" DataField="Paydate" HeaderText="Pay Date" DataFormatString="{0:d}" HeaderStyle-Width="13%" ItemStyle-Width="13%" DataType="System.DateTime" UniqueName="PayDate" AllowFiltering="true" SortExpression="PayDate" FilterControlWidth="90"> </telerik:GridDateTimeColumn>

 

 

 

 

 

<telerik:GridBoundColumn AllowFiltering="false" HeaderText="Start Date" HeaderStyle-Width="10%" ItemStyle-Width="10%" DataFormatString="{0:d}" DataField="PayDateFrom" UniqueName="PayDateFrom" DataType="System.DateTime" ShowFilterIcon="false"

 

 

SortExpression="PayDateFrom" />

 

 

 

<telerik:GridBoundColumn HeaderText="End Date" DataField="Paydateto" HeaderStyle-Width="10%" ItemStyle-Width="10%" DataFormatString="{0:d}" UniqueName="Paydateto" DataType="System.DateTime" ShowFilterIcon="false" AllowFiltering="false"

 

 

SortExpression="Paydateto" />

 

 

 

<telerik:GridBoundColumn HeaderText="Hire/Rehire" HeaderStyle-Width="10%" ItemStyle-Width="10%" DataField="EMPDOH" UniqueName="EMPDOH" DataFormatString="{0:d}" DataType="System.DateTime" ShowFilterIcon="false" AllowFiltering="false"

 

 

SortExpression="EMPDOH" />

 

 

 

<telerik:GridBoundColumn HeaderStyle-Width="2%" ItemStyle-Width="1%" DataField="hdismass" UniqueName="hdismass" HeaderText="hdismass" AllowFiltering="false"

 

 

/>

 

 

 

<telerik:GridBoundColumn HeaderStyle-Width="2%" HeaderText="hds" ItemStyle-Width="1%" DataField="hds" UniqueName="hds" AllowFiltering="false"

 

 

/>

 

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">

 

 

<Selecting AllowRowSelect="true" />

 

 

<Resizing EnableRealTimeResize="True" ResizeGridOnColumnResize="false" AllowColumnResize="true">

 

 

</Resizing>

 

 

<ClientEvents OnRowSelecting="rowselecting" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

 

</div>

 

 

<asp:SqlDataSource runat="server" ID="SqlDataSourceGrid"></asp:SqlDataSource>

 

 

<asp:SqlDataSource ID="SqlDataSourcePP" runat="server"></asp:SqlDataSource>

 

 

<asp:SqlDataSource ID="SqlDataSourceUsers" runat="server"></asp:SqlDataSource>

 

 

<asp:SqlDataSource ID="SqlDataSourceDepartment" runat="server"></asp:SqlDataSource>

and here is the codebehind function

 

Protected

 

Sub BindGrid2()

 

 

If Not IsPostBack Then

 

 

 

 

SqlDataSourceUsers.ConnectionString = ConfigurationManager.AppSettings.Item(

"ConnectString")

 

SqlDataSourceUsers.SelectCommand =

"select PrimaryKey, UserID From Security_Users Where PrimaryKey <> 1"

 

 

 

 

SqlDataSourceUsers.SelectCommandType = SqlDataSourceCommandType.Text

 

End If

 

 

 

 

SqlDataSourcePP.ConnectionString = ConfigurationManager.AppSettings.Item(

"ConnectString")

 

SqlDataSourcePP.SelectCommand =

"Select distinct Code From CT_Payperiods"

 

 

 

 

SqlDataSourcePP.SelectCommandType = SqlDataSourceCommandType.Text

SqlDataSourceDepartment.ConnectionString = ConfigurationManager.AppSettings.Item(

"ConnectString")

 

SqlDataSourceDepartment.SelectCommand =

"select DISTINCT Description as Department from CT_Departments WHERE GROUPID >= 0 "

 

 

 

 

SqlDataSourceDepartment.SelectCommandType = SqlDataSourceCommandType.Text

 

If isSelIndex = False Then BindFilters()

 

 

SqlDataSourceGrid.ConnectionString = ConfigurationManager.AppSettings.Item(

"ConnectString")

 

SqlDataSourceGrid.SelectCommand =

"Pr_GetPayEmployee"

 

 

 

 

SqlDataSourceGrid.SelectCommandType = SqlDataSourceCommandType.StoredProcedure

SqlDataSourceGrid.SelectParameters.Clear()

 

If radioGD.Items(1).Selected = True Then

 

 

 

 

SqlDataSourceGrid.SelectParameters.Add(

"mGrpKey", cmbGroup.Items(cmbGroup.SelectedIndex).Value)

 

 

Else

 

 

 

 

SqlDataSourceGrid.SelectParameters.Add(

"mGrpKey", -1)

 

 

End If

 

 

 

 

SqlDataSourceGrid.SelectParameters.Add(

"mDeptKey", -1)

 

SqlDataSourceGrid.SelectParameters.Add(

"mEmpKey ", -1)

 

 

'SqlDataSourceGrid.SelectParameters.Add("PayDate", "")

 

 

 

 

SqlDataSourceGrid.SelectParameters.Add(

"bRequired", 0)

 

SqlDataSourceGrid.SelectParameters.Add(

"PayPeriod", -1)

 

SqlDataSourceGrid.SelectParameters.Add(

"PRKEY", -1)

 

RadGrid1.DataSourceID =

"SqlDataSourceGrid"

 

 

 

 

 

 

 

End Sub

 

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 07 Jun 2010, 12:58 PM
Hello Kiran,

RadComboBox control is far more complex than the standard dropdown it is expected to be slower as it uses much more built-in JS and skin resources to provide its advanced behavior. However, there are tips and tricks to make the combobox as fast as possible. Such a tip is using the Load On Demand feature that let you load an empty combobox when the page is first loaded. Then, the items can be added as the user types in the input field. This will definitely save loading time and will improve the combobox speed.

For more information about how to optimize the performance of RadControls, please refer to the following articles:
Optimizing output, page load time and the overall performance of RadControls for ASP.NET AJAX
How to optimize your performance?

Sincerely yours,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kiran
Top achievements
Rank 1
answered on 08 Jun 2010, 05:00 PM
Hi Pavlina

I did as suggested by you, but it doesnt make any diffrence, +  we are also storing and loading the grid layout in database. so when user select any stored layout to load, in this case enableonloaddemand gives an error

please let me know if there is another way to improve the performance

Kiran
0
Pavlina
Telerik team
answered on 09 Jun 2010, 10:07 AM
Hello Kiran,

Can you please open a formal support ticket and send us a scaled down version, which I can run locally - if sending the original database is not an option, you can hard code a datatable, to populate the control with data.
As soon as I run the sample locally, I will get back to you with more information on the matter.

Thank you for your cooperation!

Best wishes,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Kiran
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Kiran
Top achievements
Rank 1
Share this question
or