using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.FormControls;
using CMS.GlobalHelper;
///
/// This form control must be used with name 'showimage'. Another blank form control with name 'showadvancedimage' must be used as well.
///
public partial class CMSFormControls_Images_ImageDialogSelector : FormEngineUserControl
{
#region "Public properties"
///
/// Indicates if control is enabled.
///
public override bool Enabled
{
get
{
return radImageSimple.Enabled;
}
set
{
radImageNo.Enabled = value;
radImageSimple.Enabled = value;
radImageAdvanced.Enabled = value;
}
}
///
/// Radiobutton 'simple' selected value.
///
public override object Value
{
get
{
return radImageSimple.Checked;
}
set
{
radImageSimple.Checked = ValidationHelper.GetBoolean(value, false);
}
}
#endregion
#region "Methods"
protected void Page_Load(object sender, EventArgs e)
{
if (ContainsColumn("ShowAdvancedImage"))
{
radImageAdvanced.Checked = ValidationHelper.GetBoolean(Form.Data.GetValue("ShowAdvancedImage"), false);
}
radImageNo.Checked = !(radImageAdvanced.Checked || radImageSimple.Checked);
}
///
/// Returns other values related to this form control.
///
/// Returns an array where first dimension is attribute name and the second dimension is its value.
public override object[,] GetOtherValues()
{
// Set properties names
object[,] values = new object[1,2];
values[0, 0] = "showadvancedimage";
values[0, 1] = radImageAdvanced.Checked;
return values;
}
///
/// Validates control.
///
public override bool IsValid()
{
bool isValid = true;
if (!ContainsColumn("showimage"))
{
ValidationError += String.Format(GetString("formcontrol.missingcolumn"), "showimage", GetString("templatedesigner.fieldtypes.boolean"));
isValid = false;
}
if (!ContainsColumn("showadvancedimage"))
{
ValidationError += String.Format(GetString("formcontrol.missingcolumn"), "showadvancedimage", GetString("templatedesigner.fieldtypes.boolean"));
isValid = false;
}
return isValid;
}
#endregion
}