or
<telerik:RadGrid ID="RadGrid1" Width="100%" Height="400px" Skin="Office2010Black" runat="server"> <mastertableview autogeneratecolumns="false" allowsorting="true" allowpaging="true" pagesize="5" datakeynames="Id" clientdatakeynames="Id"> <Columns> <telerik:GridButtonColumn UniqueName="RowSelector1" CommandName="Select" CommandArgument="" ButtonType="ImageButton" Text="Open demand" ImageUrl="~/styles/images/icon/playblue_16x16.png" HeaderStyle-Width="25px" Resizable="false" /> <telerik:GridBoundColumn DataField="Id" HeaderText="Id" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Description" HeaderText="Description" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Street" HeaderText="Street" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ZipCode" HeaderText="ZipCode" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="City" HeaderText="City" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Picture" HeaderText="Picture" AllowSorting="true"> </telerik:GridBoundColumn> </Columns> <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" SEOPagingQueryStringKey="PageId" EnableSEOPaging="true" /> </mastertableview> <clientsettings allowcolumnhide="true" allowcolumnsreorder="false" allowdragtogroup="false" allowexpandcollapse="true" allowgroupexpandcollapse="true" enablepostbackonrowclick="false" enablerowhoverstyle="true" reordercolumnsonclient="true"> <ClientEvents OnRowDblClick="prvOnRadGrid1_RowDblClick" /> <Resizing AllowColumnResize="true" ShowRowIndicatorColumn="true" /> <Selecting AllowRowSelect="true" /> <Scrolling ScrollHeight="100%" AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" FrozenColumnsCount="0" /> </clientsettings></telerik:RadGrid>
| Tours | agencyname | dtMonthno | dtMonthBrand | dtYear | |
| 6 | agents | 5 | May | 2011 | |
| 8 | agents | 6 | June | 2011 | |
| 2 | agents | 7 | July | 2011 | |
| 23 | agents | 8 | August | 2011 | |
| 126 | agents | 9 | September | 2011 | |
| 101 | agents | 10 | October | 2011 | |
| 85 | agents | 11 | November | 2011 | |
| 92 | agents | 12 | December | 2011 | |
| 115 | agents | 1 | January | 2012 | |
| 102 | agents | 2 | February | 2012 | |
| 48 | agents | 3 | March | 2012 |
foreach (string aId in aAgency) { DataTable dtBrands = count.GetBrandsChartData(Convert.ToDateTime(txtStartDate.Text), Convert.ToDateTime(txtEndDate.Text), Convert.ToInt32(aId)); bool morethenTwelve = false; if (dtBrands.Rows.Count > 0) { ChartSeries brandChartSeries = new ChartSeries(); brandChartSeries.Name = dtBrands.Rows[0][1].ToString(); brandChartSeries.Type = ChartSeriesType.Line; foreach (DataRow dr in dtBrands.Rows) { ChartSeriesItem chartitem = new ChartSeriesItem(); chartitem.YValue = Convert.ToDouble(dr["Tours"]); if (morethenTwelve == false) { dtMontno = Convert.ToInt32(dr["dtMonthno"]); } if (dtMontno == 12) { chartitem.XValue = Convert.ToDouble(dr["dtMonthno"]); morethenTwelve = true; dtMontno = 13; } else if (dtMontno > 12) { chartitem.XValue = Convert.ToDouble(dtMontno += 1); morethenTwelve = true; } else { chartitem.XValue = Convert.ToDouble(dr["dtMonthno"]); morethenTwelve = false; } brandChartSeries.AddItem(chartitem); radBrands.PlotArea.XAxis[dtMonth - 1].TextBlock.Text = dr["dtMonthBrand"].ToString(); } radBrands.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Inside; radBrands.ChartTitle.TextBlock.Text = "Brands"; radBrands.PlotArea.XAxis.AutoScale = false; radBrands.AddChartSeries(brandChartSeries); radBrands.Series.Add(brandChartSeries); } }private void InitializeComponent(){ this.DataBinding += new System.EventHandler(this.RandomName_DataBound);}ComboBox.ItemTemplate = new ItemTemplate();ComboBox.ItemDataBound += ComboBox_ItemDataBound;ComboBox.Width = Unit.Pixel(500);ComboBox.AllowCustomText = true;ComboBox.MarkFirstMatch = true;ComboBox.DataSource = GetVendorList();ComboBox.DataTextField = "Name";ComboBox.DataBind();foreach (RadComboBoxItem item in ComboBox.Items){ item.DataBind();}protected void RandomName_DataBound(object sender, EventArgs e){ // do stuff here}class ItemTemplate : ITemplate{ public void InstantiateIn(Control container) { Table table = new Table(); table.Width = Unit.Percentage(100); TableRow mainRow = new TableRow(); TableCell cell1 = new TableCell(); cell1.Width = Unit.Percentage(40); cell1.DataBinding += new EventHandler(cell1_DataBinding); mainRow.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.DataBinding += new EventHandler(cell2_DataBinding); cell2.Width = Unit.Percentage(30); mainRow.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.DataBinding += new EventHandler(cell3_DataBinding); cell3.Width = Unit.Percentage(30); mainRow.Cells.Add(cell3); table.Rows.Add(mainRow); container.Controls.Add(table); } private void cell1_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Text"); } private void cell2_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Attributes[\"Type\"]"); } private void cell3_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Attributes[\"Phone\"]"); }}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" /></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <%--Needed for JavaScript IntelliSense in VS2010--%> <%--For VS2008 replace RadScriptManager with ScriptManager--%> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <script type="text/javascript"> //Put your JavaScript code here. </script> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadButtonAdd"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadTabStripContent" /> <telerik:AjaxUpdatedControl ControlID="LabelCount" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadButtonClose_Click"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadTabStripContent" /> <telerik:AjaxUpdatedControl ControlID="LabelCount" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <div style="height: 100px; background-color: gray;"> <telerik:RadTabStrip ID="RadTabStripContent" runat="server" Skin="Simple" ScrollChildren="true" dir="LTL" EnableEmbeddedSkins="true" Visible="true"> <TabTemplate> <asp:Label ID="LabelTabName" runat="server" /> Tab </TabTemplate> </telerik:RadTabStrip> </div> <telerik:RadButton runat="server" ID="RadButtonAdd" Text="Add" OnClick="RadButtonAdd_Click"></telerik:RadButton> <telerik:RadButton runat="server" ID="RadButtonClose" Text="close" OnClick="RadButtonClose_Click"></telerik:RadButton> <asp:Label runat="server" ID="LabelCount" Text="Tab Count:"></asp:Label> </form></body></html>using System;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Configuration;using System.Web.Security;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Telerik.Web.UI;public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void RadButtonClose_Click(object sender, EventArgs e) { RadTabStripContent.Tabs.RemoveAt(RadTabStripContent.Tabs.Count -4); LabelCount.Text = "Tab Count:" + RadTabStripContent.Tabs.Count; } protected void RadButtonAdd_Click(object sender, EventArgs e) { RadTab tab = new RadTab(); tab.Text = "TAB "+ (RadTabStripContent.Tabs.Count + 1).ToString(); RadTabStripContent.Tabs.Add(tab); LabelCount.Text = "Tab Count:" + RadTabStripContent.Tabs.Count; }}
Hello techies,
We are using the RagGrid on a test page for performance testing.
We were surprised to notice that a simple page with 100 elements in the GRID takes on an average about 2 seconds. We are doing a load test on Win Server 2008 R2. We are not using a real database. We are using a STUB to generate the 100 odd elements.
The same STUB when used on ASP.net MVC page with simple HTML table rendering out performs the RadGrid Page. The MVC page takes about 0.37 seconds.
Test Environment : ASP.net 4.0 / RadControls for ASP.NET AJAX Q2 2011 SP1 / Windows Server 2008 R2 / IIS 7.5 / Application pool type “Integrated Pipeline”
Any ideas?
Advance thanks,
<telerik:RadComboBox ID="rcbSiteSearch" runat="server" Width="190px" Height="100px" EnableLoadOnDemand="True" ShowMoreResultsBox="true" MarkFirstMatch="true" AllowCustomText="true" EnableVirtualScrolling="true" OnItemsRequested="rcbSiteSearch_ItemsRequested" />Protected Sub rcbSiteSearch_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) Const ItemsPerRequest As Integer = 5 Dim data As DataTable = GetSiteName(e.Text) Dim itemOffset As Integer = e.NumberOfItems Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count) e.EndOfItems = endOffset = data.Rows.Count For i As Integer = itemOffset To endOffset - 1 rcbSiteSearch.Items.Add(New RadComboBoxItem(data.Rows(i)("name").ToString(), data.Rows(i)("value").ToString())) Next e.Message = GetStatusMessage(endOffset, data.Rows.Count) End Sub Private Shared Function GetSiteName(ByVal text As String) As DataTable Dim StateCode As String = "pa" Dim connectionString As String = *Connection String* Dim QueryStr As String = *QUERY* Dim adapter As New SqlDataAdapter(QueryStr,connectionString) Dim Data As New DataTable() Try adapter.Fill(Data) Catch ex As Exception Call MsgBox(String.Format("Unexpected Error: {0}", ex.ToString()), 0, "Unexpected Search Error") End Try Return Data End Function Private Shared Function GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String If total <= 0 Then Return "No matches" End If Return [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total) End Function