Hi,
We use Telerik AJAX ASP.NET extensively. On one page the page response time is very critical. On this page we are using RadGrid and RadComboBox. We have included RadScriptManager too.
One issue we are facing is that when user accesses this page for first time then Telerik.Web.UI.WebResource.js file is downloaded. This file is about 0.7 MB is size! This is creating major performance issues due to which we are being forced to re-write the page without Telerik.
Is there a way to reduce this size? On this particular page we are just using the RadGrid and RadComboBox- is there a way that we include the js for just these two controls? Or is there some other way?
Note: Using Telerik CDN is not going to help as using this yet on first visit the js file size would remain the same. Using RadCompression is not going to help as main problem is the 0.7 MB size of Telerik.Web.UI.WebResource.js.
I googled a bit but did not find a solution. PLEASE HELP, else its bye bye Telrik for us!
Thanks,
- Manoj
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
public class ExpertiseListView : SimpleView { #region control info public static Guid GroupPageGuid = new Guid("6743bffb-7cce-4e5c-9d9e-fc7ff1fa5e73"); public static Guid PageGuid = new Guid("f0608080-5054-48b7-8218-a72ac6842e40"); public static string TemplateName = "ContactsFormModule.Resources.Backend.ExpertiseListView.ascx"; protected override string LayoutTemplateName { get { return TemplateName; } } #endregion #region controls protected virtual ITextControl LblTitle { get { return base.Container.GetControl<ITextControl>("LblTitle", true); } } protected virtual HyperLink BtnAdd { get { return base.Container.GetControl<HyperLink>("BtnAdd", true); } } protected virtual RadGrid GvExpertise { get { return base.Container.GetControl<RadGrid>("GvExpertise", true); } } #endregion public static string FieldName(bool isGeneral, bool isCompany) { if (isGeneral && isCompany) return "..."; else if (isGeneral) return ".."; else if (isCompany) return "."; else return string.Empty; } protected override void InitializeControls(GenericContainer container) { LblTitle.Text = "Expertise"; LblAdd.Text = "Dodaj"; //BtnAdd.NavigateUrl = App.WorkWith().Page(ExpertiseEditView.PageGuid).Get().GetFullUrl(); GvExpertise.NeedDataSource += GvExpertise_NeedDataSource; GvExpertise.ItemCommand += GvExpertise_ItemCommand; GvExpertise.ItemDataBound += GvExpertise_ItemDataBound; } void GvExpertise_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { GvExpertise.DataSource = new ContactsManager().Expertises; } void GvExpertise_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { ((LinkButton)((GridDataItem)e.Item)["DeleteColumn2"].Controls[0]).Text = ((Expertise)e.Item.DataItem).IsVisible ? "skrij" : "prikaži"; ((Literal)((GridDataItem)e.Item)["Field"].Controls[0]).Text = FieldName(((Expertise)e.Item.DataItem).General,((Expertise)e.Item.DataItem).Company); } } void GvExpertise_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "hide") { int iId = (int)((GridDataItem)e.Item).GetDataKeyValue("Id"); ContactsManager dataContext = new ContactsManager(); Expertise expertise = dataContext.Expertises.FirstOrDefault(x => x.Id == iId); expertise.IsVisible = !expertise.IsVisible; dataContext.SaveChanges(); GvExpertise.DataSource = new ContactsManager().Expertises; this.GvExpertise.DataBind(); } else if (e.CommandName == RadGrid.ExportToCsvCommandName || e.CommandName == RadGrid.ExportToExcelCommandName || e.CommandName == RadGrid.ExportToPdfCommandName) { GvExpertise.MasterTableView.Columns[3].Visible = false; GvExpertise.MasterTableView.Columns[4].Visible = false; } } }
<div class="sfWorkArea"> <div class="sfMessage sfGridViewMessage"><asp:Literal id="LblMessage" runat="server"></asp:Literal></div> <div> <div class="RadGrid RadGrid_Sitefinity rgTopOffset" tabindex="0"> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="GvExpertise" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="GvExpertise" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="0" Width="100%" DataKeyNames="Id" GridLines="None" PageSize="30" EnableModelValidation="True" Skin="Sitefinity"> <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True" HideStructureColumns="true"> <Excel Format="Biff"></Excel> <Csv ColumnDelimiter="Semicolon" RowDelimiter="NewLine" EncloseDataWithQuotes="true" FileExtension=".csv" /> </ExportSettings> <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top"> <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true" ShowExportToCsvButton="true"/> <Columns> <telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" /> <telerik:GridBoundColumn DataField="Description" HeaderText="Strokovno znanje" SortExpression="Description" /> <telerik:GridTemplateColumn DataField="Company,General" SortExpression="Company,General" UniqueName="Field"><ItemTemplate><asp:Literal runat="server" ID="LblField" /></ItemTemplate></telerik:GridTemplateColumn> <telerik:GridHyperLinkColumn DataNavigateUrlFields="Id" /> <telerik:GridButtonColumn Text='' ButtonType="LinkButton" CommandName="hide" UniqueName="DeleteColumn2"><HeaderStyle Width="20px"></HeaderStyle></telerik:GridButtonColumn> </Columns> </MasterTableView> </telerik:RadGrid> </div> </div> </div>

<%@ Register Src="~/secured/IntakeRequest/ascx/DocumentRepository.ascx" TagName="DocumentRepository" TagPrefix="ADAAC" %><telerik:RadScriptManager runat="server" ID="RadScriptManager1" /><telerik:RadFormDecorator ID="radFormDecorator" runat="server" DecoratedControls="All" Skin="Office2010Silver" EnableRoundedCorners="false" /> <telerik:RadAjaxManager runat="server" ID="radAjaxManager1" OnAjaxRequest="radAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="radAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="adaacDocumentRepository" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadScriptBlock runat="server"> <script type="text/javascript"> function windowCommunicationLog_OnClientBeforeShow(sender, args) { var ajaxManager = $find("<%= radAjaxManager1.ClientID %>"); ajaxManager.ajaxRequest("windowCommunicationLog_OnClientBeforeShow"); } </script></telerik:RadScriptBlock><telerik:RadWindow runat="server" ID="windowDocumentRepository" Title="Document Repository" Width="1024" Height="700" VisibleOnPageLoad="false" Behaviors="Close, Move" EnableShadow="true" Modal="true" DestroyOnClose="false" OnClientBeforeShow="windowDocumentRepository_OnClientBeforeShow"> <ContentTemplate> <ADAAC:DocumentRepository runat="server" ID="adaacDocumentRepository" /> </ContentTemplate></telerik:RadWindow>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
windowDocumentRepository.OpenerElementID = btnImportDocument.ClientID;
}
protected
void radAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{ if (e.Argument == "windowDocumentRepository_OnClientBeforeShow") { // the only thing this does is bind a repeater with a list of documents already uploaded adaacDocumentRepository.BindDocuments(); }}<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel2" Skin="Metro" BackgroundPosition="Center" Direction="LeftToRight" EnableSkinTransparency="false"></telerik:RadAjaxLoadingPanel><telerik:RadAjaxManagerProxy runat="server" ID="radAjaxManagerProxy1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="btnUploadFile"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="btnUploadFile" LoadingPanelID="RadAjaxLoadingPanel2" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManagerProxy><telerik:RadWindow runat="server" ID="windowAddDocument" Title="Import a Document" Width="800" Height="250" VisibleOnPageLoad="false" Behaviors="Close, Move" EnableShadow="true" Modal="true" IconUrl="/images/windowIcon.png"> <ContentTemplate> <div><b>Select a document to upload</b></div> <div> File: </div> <div> <telerik:RadAsyncUpload runat="server" MaxFileInputsCount="1" ID="fileUpload1" ControlObjectsVisibility="None" Width="375" /> </div> <div> <asp:Button runat="server" ID="btnUploadFile" OnClick="btnUploadFile_OnClick" Text="Upload File" /> </div> <div> Browse for a file and then hit the "Upload" button. </div> </ContentTemplate></telerik:RadWindow><div> <asp:ImageButton ImageUrl="adddoc.jpg" AlternateText="Add a Document" runat="server" ID="btnUploadDoc" /></div>protected void Page_Load(object sender, EventArgs e){ RadAjaxManager manager = RadAjaxManager.GetCurrent(Page); manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(radAjaxManager1_AjaxRequest); if (!IsPostBack) { windowAddDocument.OpenerElementID = btnUploadDoc.ClientID; }}protected void btnUploadFile_OnClick(object o, EventArgs e){ if (fileUpload1.UploadedFiles.Count == 1) { string encFileName = Guid.NewGuid() + GetFileExtension(fileUpload1.UploadedFiles[0].FileName); string uploadPath = Server.MapPath("/documents/" + encFileName); fileUpload1.UploadedFiles[0].SaveAs(uploadPath); BindDocuments(); // this just rebinds the uploaded documents }}protected void radAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e){ // this is just here so I can use radconfirm to do file deletions from the grid}{ 'isEnabled':'true', 'uploadedFiles':[ { "fileInfo":{ "FileName":"Footer Graphic.png", "ContentType":"image/png", "ContentLength":18389, "Index":0 }, "metaData":"/wEFwwF7IlRlbXBGaWxlTmFtZSI6IjEzNTU4NzU4MzI1NjFGb290ZXIgR3JhcGhpYy5wbmciLCJBc3luY1VwbG9hZFR5cGVOYW1lIjoiVGVsZXJpay5XZWIuVUkuVXBsb2FkZWRGaWxlSW5mbywgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMi4yLjkxMi4zNSwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0In0NCNiTh2r8IZeBu1RIF0/Xu3qk/w==" } ]},