Taylohtio/GeneralApi/GeneralApi.MOSS/BoardMembersWebPart/BoardMembersWebPart.cs

55 lines
1.6 KiB
C#

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Taloyhtio.GeneralApi.MOSS.CONTROLTEMPLATES.Taloyhtio.Integration;
using Taloyhtio.GeneralApi.Resources.Resources;
namespace Taloyhtio.GeneralApi.MOSS
{
public class BoardMembersWebPart : WebPart
{
private bool error;
[Personalizable(PersonalizationScope.Shared), WebBrowsable(), Category("Taloyhtio")]
public string VisibleProperties
{
get;
set;
}
protected override void CreateChildControls()
{
if (!this.error)
{
try
{
base.CreateChildControls();
var ctrl = this.Page.LoadControl("~/_ControlTemplates/15/Taloyhtio/Integration/BoardMembers.ascx") as BoardMembers;
if (ctrl != null)
{
ctrl.VisibleProperties = this.VisibleProperties;
this.Controls.Add(ctrl);
}
}
catch (Exception x)
{
this.handleException(x);
}
}
}
private void handleException(Exception x)
{
this.error = true;
this.Controls.Clear();
this.Controls.Add(new LiteralControl(string.Format("<span style=\"color: Red\">{0}</span>", x.Message)));
}
}
}