RadGrid Disable embedded scripts - what scripts to use?

0 Answers 57 Views
Grid ScriptManager and StyleSheetManager
John
Top achievements
Rank 1
John asked on 04 Apr 2023, 05:30 PM

I am trying to disable embeddedscripts for radgrid - everything works but context menu - which scripts altogether do I need to add?

This write up (linked below) is incorrect or out of date - can someone please help.

https://docs.telerik.com/devtools/aspnet-ajax/getting-started/performance/disabling-embedded-resources#disabling-embedded-resources

Rumen
Telerik team
commented on 05 Apr 2023, 08:49 AM | edited

Hi John,

You can put only RadGrid on an empty webforms page, enable the CDN via the RadScriptManager and see which js files are loaded in the Network tab of Google Chrome.

<telerik:RadScriptManager runat="server" CdnSettings-TelerikCdn="Enabled" EnableScriptCombine="false" />
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource" EnableHeaderContextMenu="true">
   ...


This will tell you which JS files to load for the specific Telerik.Web.UI.dll version in your project:


 

You can also perform the same test by setting EnableScriptCombine to true.

 

John
Top achievements
Rank 1
commented on 05 Apr 2023, 01:16 PM

Hi Rumen,

Thanks for your help, but unfortunately I cannot use RadScriptManager at this time because I am using DotNetNuke CMS.  I am using scriptmanagerproxy to add the js files.  But by looking at your picture - I have all files except for highlighter.js which I cannot find anywhere in scripts folder?  The telerik version I am using is 2022.3.913.45.  Where can I get this file?

John
Top achievements
Rank 1
commented on 05 Apr 2023, 01:19 PM

p.s. also missing axe.js?
Rumen
Telerik team
commented on 05 Apr 2023, 01:58 PM | edited

Sorry, axe and highlighter.js are scripts coming from Chrome extensions installed on my machine.

Here is the complete list of js files when I also enable the MS AJAX CDN scripts and load the page in Incognito mode of Chrome:

 

        <telerik:RadScriptManager runat="server" CdnSettings-TelerikCdn="Enabled" EnableScriptCombine="false" EnableCdn="true" />
        
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource"  EnableHeaderContextMenu="true">

 

 

and here is the result of the following grid configuration and imported scripts:

        <asp:ScriptManager runat="server" EnableCdn="true">
            <Scripts>
                <asp:ScriptReference Path="~/Scripts/Common/Core.js" />
                <asp:ScriptReference Path="~/Scripts/Common/jQuery.js" />
                <asp:ScriptReference Path="~/Scripts/Common/jQueryPlugins.js" />
                <asp:ScriptReference Path="~/Scripts/Common/Navigation/OData/OData.js" />
                <asp:ScriptReference Path="~/Scripts/Common/AnimationFramework/AnimationFramework.js" />
                <asp:ScriptReference Path="~/Scripts/Common/Navigation/NavigationScripts.js" />
                <asp:ScriptReference Path="~/Scripts/Common/Navigation/OverlayScript.js" />
                <asp:ScriptReference Path="~/Scripts/Common/TouchScrollExtender.js" />
                <asp:ScriptReference Path="~/Scripts/ComboBox/RadComboBoxScripts.js" />
                <asp:ScriptReference Path="~/Scripts/ComboBox/Views/LiteView.js" />
                <asp:ScriptReference Path="~/Scripts/Common/Scrolling/ScrollingScripts.js" />
                <asp:ScriptReference Path="~/Scripts/Menu/RadMenuScripts.js" />
                <asp:ScriptReference Path="~/Scripts/Menu/ContextMenu/RadContextMenuScripts.js" />
                <asp:ScriptReference Path="~/Scripts/Menu/MenuItem/RadMenuItem.js" />
                <asp:ScriptReference Path="~/Scripts/Menu/Views/LiteView.js" />
                <asp:ScriptReference Path="~/Scripts/Grid/RadGridScripts.js" />
            </Scripts>
        </asp:ScriptManager>

        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource" EnableEmbeddedScripts="false" EnableHeaderContextMenu="true">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"
                        FilterControlAltText="Filter OrderID column" HeaderText="OrderID"
                        ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="OrderDate" DataType="System.DateTime"
                        FilterControlAltText="Filter OrderDate column" HeaderText="OrderDate"
                        SortExpression="OrderDate" UniqueName="OrderDate">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal"
                        FilterControlAltText="Filter Freight column" HeaderText="Freight"
                        SortExpression="Freight" UniqueName="Freight">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="ShipName"
                        FilterControlAltText="Filter ShipName column" HeaderText="ShipName"
                        SortExpression="ShipName" UniqueName="ShipName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShipCountry"
                        FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry"
                        SortExpression="ShipCountry" UniqueName="ShipCountry">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

 

    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        (sender as RadGrid).DataSource = OrdersTable(); 
    }

    private DataTable OrdersTable()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn("OrderID", typeof(int)));
        dt.Columns.Add(new DataColumn("OrderDate", typeof(DateTime)));
        dt.Columns.Add(new DataColumn("Freight", typeof(decimal)));
        dt.Columns.Add(new DataColumn("ShipName", typeof(string)));
        dt.Columns.Add(new DataColumn("ShipCountry", typeof(string)));

        dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] };

        for (int i = 0; i < 70; i++)
        {
            int index = i + 1;

            DataRow row = dt.NewRow();

            row["OrderID"] = index;
            row["OrderDate"] = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddHours(index);
            row["Freight"] = index * 0.1 + index * 0.01;
            row["ShipName"] = "Name " + index;
            row["ShipCountry"] = "Country " + index;

            dt.Rows.Add(row);
        }

        return dt;
    }

 

No answers yet. Maybe you can help?

Tags
Grid ScriptManager and StyleSheetManager
Asked by
John
Top achievements
Rank 1
Share this question
or