Open mywidget.ascx.cs (Vb.Net: Select mywidget.ascx and right click. Click View Code) and add IWidgetControl interface to mywidget class. This will provide you to capture widget commands. Paste the below code.
C#
#region IWidgetControl Members
public void Bind(WidgetInstance instance) {
Label1.Text = string.Format("Bound at {0}", DateTime.Now);
}
public UpdatePanel[] Command(WidgetInstance instance, Kalitte.Dashboard.Framework.WidgetCommandInfo commandData, ref UpdateMode updateMode) {
switch (commandData.CommandType)
{
case Kalitte.Dashboard.Framework.WidgetCommandType.Refresh:
{
Label1.Text = string.Format("Refreshed at {0}", DateTime.Now);
return new UpdatePanel [] { UpdatePanel1 };
}
default: return null;
}
}
public void InitControl(Kalitte.Dashboard.Framework.WidgetInitParameters parameters) {}
#endregion
VB.NET
Imports Kalitte.Dashboard.Framework.Types
Imports Kalitte.Dashboard.Framework
Partial Public Class mywidget
Inherits System.Web.UI.UserControl
Implements IWidgetControl
Public Sub Bind(ByVal instance As WidgetInstance) Implements IWidgetControl.Bind
Label1.Text = String.Format("Bound at {0}", DateTime.Now)
End Sub
Public Sub InitControl(ByVal parameters As WidgetInitParameters) Implements IWidgetControl.InitControl
End Sub
Public Function Command(ByVal instance As WidgetInstance, ByVal commandData As WidgetCommandInfo, ByRef updateMode As UpdateMode) As UpdatePanel() Implements IWidgetControl.Command
Select Case commandData.CommandType
Case WidgetCommandType.Refresh
Label1.Text = String.Format("Refreshed at {0}", DateTime.Now)
Return New UpdatePanel() {UpdatePanel1}
Case Else
Return Nothing
End Select
End Function
End Class