Custom widget for responsive images: Implement the client side of the ResponsiveImage widget designer

You need to get the ID of the selected image and pass it from the designer to the widget. This is achieved on the client-side by the applyChanges method.

In Visual Studio, perform the following:

  1. In the context menu of Designer folder, click Add » JavaScript File.
  2. Name the file ResponsiveImageDesigner.js
  3. Right-click on the js file and set the Build Action property to Embedded Resource.
  4. Expand the Properties folder of the ResponsiveImages class library and click to edit the AssemblyInfo.cs.
  5. Add the following line:
    [assembly: WebResource("ResponsiveImages.Designer.ResponsiveImageDesigner.js", "application/x-javascript")]
  6. Implement the JavaScript code of the ResponsiveImageDesigner.js file.

    EXAMPLE: For more information about the content of the file, see the ResponsiveImageDesigner.js file of the downloaded sample project.

  7. Build you solution.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?