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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?