First off, I'd like to mention that I am a complete noob when it comes to C#. It's a steep hill to climb. :)
In any case, I'm creating an addin class for Microsoft Dynamics NAV, that will display a list of data using the Telerik gridview control. In one of those columns I'd like to show a progress bar. I've seen how you can add code to the cell formatting event trigger, but I don't know how to do that when I do not have an interface in my solution. All the examples I've seen reference form controls.
Any help is extremely appreciated. For reference, this is my code below. It works great for what i need with exception of the progress bar column. the grid is being populated from teh contents of a published web service.
In any case, I'm creating an addin class for Microsoft Dynamics NAV, that will display a list of data using the Telerik gridview control. In one of those columns I'd like to show a progress bar. I've seen how you can add code to the cell formatting event trigger, but I don't know how to do that when I do not have an interface in my solution. All the examples I've seen reference form controls.
Any help is extremely appreciated. For reference, this is my code below. It works great for what i need with exception of the progress bar column. the grid is being populated from teh contents of a published web service.
namespace
AddInSamples
{
using
System.ComponentModel;
using
System.Drawing;
using
System.Windows.Forms;
using
Microsoft.Dynamics.Framework.UI.Extensibility;
using
Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
using
WorkCenterRef;
[ControlAddInExport(
"WorkCenterStatusListTelerik"
)]
public
class
StaticNoCaptionAddIn : WinFormsControlAddInBase
{
private
WorkCenterRef.WorkCenter_Service workCenterList;
private
WorkCenterRef.WorkCenter[] workCenters;
private
Telerik.WinControls.UI.RadGridView dataGrid;
protected
override
Control CreateControl()
{
dataGrid =
new
RadGridView();
GridViewTextBoxColumn column1 =
new
GridViewTextBoxColumn(
"No."
);
GridViewTextBoxColumn column2 =
new
GridViewTextBoxColumn(
"Name"
);
GridViewDecimalColumn column3 =
new
GridViewDecimalColumn(
"% Capacity"
);
GridViewTextBoxColumn column4 =
new
GridViewTextBoxColumn(
"ProgressBar"
);
column4.DataType =
typeof
(
int
);
column1.Width = 100;
column2.Width = 100;
column3.Width = 100;
column4.Width = 100;
this
.dataGrid.Columns.Add(column1);
this
.dataGrid.Columns.Add(column2);
this
.dataGrid.Columns.Add(column3);
this
.dataGrid.Columns.Add(column4);
workCenterList =
new
WorkCenter_Service();
workCenterList.UseDefaultCredentials =
true
;
workCenters = workCenterList.ReadMultiple(
null
,
null
, 0);
this
.dataGrid.TableElement.BeginUpdate();
this
.dataGrid.AllowAddNewRow =
false
;
this
.dataGrid.AllowDeleteRow =
false
;
this
.dataGrid.AllowEditRow =
false
;
this
.dataGrid.AllowDragToGroup =
false
;
column4.ReadOnly =
true
;
foreach
(WorkCenterRef.WorkCenter workCenter
in
workCenters)
{
this
.dataGrid.Rows.Add(workCenter.No, workCenter.Name, workCenter.Percent_Capacity);
}
this
.dataGrid.TableElement.EndUpdate();
return
dataGrid;
}
/// <summary>
/// Gets a values indicating whether the control shall show a caption.
/// Overrides the implementation of StringControlAddInBase for IWinFormsControlAddIn.AllowCaptionControl
/// </summary>
public
override
bool
AllowCaptionControl
{
get
{
return
false
;
}
}
}
}