Getting widget data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can get a widget as a WidgetInfo object:

 

[C#]

 

using CMS.PortalEngine;

 

...

 

        // Get widget object by ID

        WidgetInfo wi = WidgetInfoProvider.GetWidgetInfo(1);

 

        // Get widget object by code name

        WidgetInfo wi2 = WidgetInfoProvider.GetWidgetInfo("TestWidget");

 

The following sample code shows how you can get a DataSet containing widgets from the system:

 

[C#]

 

using System.Data;

using CMS.PortalEngine;

 

...

 

        string where = "WidgetCategoryID = 76";

        string orderBy = "WidgetDisplayName";

        int topN = 10;

        string columns = "WidgetID, WidgetDisplayName, WidgetCategoryID";

 

        // Get dataset of widgets according to the given parameters

        DataSet ds = WidgetInfoProvider.GetWidgets(where, orderBy, topN, columns);

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_widget_data.htm