Published on

Prevent RadListView bloating your page with HTML

Authors

Most of the “List\Master” widgets in Sitefinity Webforms use the telerik:RadListView control, and don’t get me wrong, it’s a GREAT server-side control to use.  Way nicer to code with than the standard asp:Repeater.

Lets look at the default events definition

So be default across the system they ALREADY stop all stylesheets from coming down.  Which is great right, you don’t want any default styling, the control is basically a repeater.

The PROBLEM though is that there are clientside scripts that come down…a lot of them :)  It’s more visible when you enable the CDN from the backend, but with just one single RadListView on your page you get.
- Core.js
- Custom jQuery.js
- RadListView.js

Bunch of beefy client scripts coming down which you will never use, and actually it’ll also throw some markup at the bottom of your page to register the client objects as well.

Here’s the fix :)

If you just set EnableEmbeddedScripts to false you’ll get script errors on the page because the script manager is putting the above mentioned markup\code to register the widget.  So that’s where you need to tell the scriptmanager to just NOT register this guy.

…now boom, on all my pages where I don’t have any RadControls I no longer have 2 versions of jQuery plus other bloat coming down.

Boost your online presence.

Let us create the perfect digital experience for your company.

Contact us now