ExternalClientScripts - Using a embedded resource

Posted by Community Admin on 05-Aug-2018 02:28

ExternalClientScripts - Using a embedded resource

All Replies

Posted by Community Admin on 29-Apr-2011 00:00

In the products sample, in the ProductsDefinitions.cs file, there is a method "ExternalClientScripts" of "productsGridView" that takes an external script as input.

Since this is a static class of definitions how would you specify an embedded resource?

Posted by Community Admin on 29-Apr-2011 00:00

Hi Victor,

Try to use the following code:

var externalScripts = new Dictionary<string, string>();
externalScripts.Add("YourModule.Resources.MasterListViewExtensions.js, YourModule", "OnMasterViewLoaded");
productsGridView.ExternalClientScripts = externalScripts;

and the code of embedded javascript file:
// called by the MasterGridView when it is loaded
function OnMasterViewLoaded(sender, args)
    //your code here

Note: the build action of MasterListViewExtensions.js should be Embedded Resource.

I hope this helps.

Best wishes,
Anton.

Posted by Community Admin on 29-Apr-2011 00:00

Genius!

Thanks, it worked perfectly.

This thread is closed