+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / ExternalClientScripts - Using a embedded resource

ExternalClientScripts - Using a embedded resource

3 posts, 1 answered
  1. Victor
    Victor avatar
    15 posts
    Registered:
    24 Mar 2011
    29 Apr 2011
    Link to this post
    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?
  2. Anton Mernov
    Anton Mernov avatar
    110 posts
    Registered:
    03 Dec 2008
    29 Apr 2011
    Link to this post
    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.
    Answered
  3. Victor
    Victor avatar
    15 posts
    Registered:
    24 Mar 2011
    29 Apr 2011
    Link to this post
    Genius!

    Thanks, it worked perfectly.
3 posts, 1 answered