and here's the code-behind:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EVI.BullsEye.BLL;
using System.Diagnostics;
namespace EVI.BullsEye.Web.Admin.Setup.SystemSettings.EmailSettings
{
public partial class Details : Admin.Page
{
protected int? _clientEmailID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
typeList.DataBind();
}
else
{
}
savedLiteral.Visible = false;
}
protected void sendEmailCustomValidator_ServerValidate(object sender, ServerValidateEventArgs args)
{
CustomValidator sendEmailCustomValidator = (CustomValidator)clientEmailFormView.FindControl("sendEmailCustomValidator");
if (args.Value.Trim().Length > 0)
{
string[] toAddresses = args.Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string toAddress in toAddresses)
{
if (!Utils.IsValidEmail(toAddress))
{
args.IsValid = false;
sendEmailCustomValidator.ErrorMessage = "The TO e-mail(s) specified was in an invalid format.";
break;
}
}
}
else
{
CheckBox enabledCheckBox = (CheckBox)clientEmailFormView.FindControl("enabledCheckBox");
if (enabledCheckBox.Checked)
{
args.IsValid = false;
sendEmailCustomValidator.ErrorMessage = "The TO e-mail(s) is required.";
}
}
}
protected void clientEmailFormView_DataBound(object sender, EventArgs e)
{
SetEmailTypeUI();
}
private void SetEmailTypeUI()
{
ClientEmail emailSetting = (ClientEmail)clientEmailFormView.DataItem;
MultiView typeMultiView = (MultiView)clientEmailFormView.FindControl("typeMultiView");
CheckBox enabledCheckBox = (CheckBox)clientEmailFormView.FindControl("enabledCheckBox");
Panel emailToPanel = (Panel)clientEmailFormView.FindControl("emailToPanel");
string viewName = null;
switch (emailSetting.EmailTypeID)
{
case (int)ClientEmail.Type.GotNewLeads:
enabledCheckBox.Enabled = false;
enabledCheckBox.Checked = false;
emailToPanel.Visible = true;
viewName = "newLeadsView";
break;
case (int)ClientEmail.Type.LeadNeedsAttention:
viewName = "attentionView";
emailToPanel.Visible = false;
break;
case (int)ClientEmail.Type.UnAssignedExists:
viewName = "unassignedView";
emailToPanel.Visible = true;
break;
case (int)ClientEmail.Type.UploadThankYou:
enabledCheckBox.Visible = false;
viewName = "uploadView";
emailToPanel.Visible = false;
break;
case (int)ClientEmail.Type.WebThankYou:
enabledCheckBox.Visible = false;
viewName = "webView";
emailToPanel.Visible = false;
break;
case (int)ClientEmail.Type.WelcomeToSystem:
//enabledCheckBox.Enabled = false;
//enabledCheckBox.Checked = false;
viewName = "welcomeView";
emailToPanel.Visible = false;
break;
}
typeMultiView.SetActiveView((View)clientEmailFormView.FindControl(viewName));
}
protected void clientEmailDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["clientID"] = this.CurrentClientID;
}
protected void clientEmailDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["clientID"] = this.CurrentClientID;
CuteEditor.Editor myEdit = (CuteEditor.Editor)clientEmailFormView.FindControl("contentEditor");
Debug.WriteLine(myEdit.Text);
}
protected void clientEmailFormView_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
{
savedLiteral.Visible = true;
}
protected void contentEditor_Load(object sender, EventArgs e)
{
string clientImagePath = GetLocalClientResourcePath() + "/editorImages";
if(!System.IO.Directory.Exists(clientImagePath))
System.IO.Directory.CreateDirectory(clientImagePath);
((CuteEditor.Editor)sender).SetSecurityImageGalleryPath(clientImagePath);
}
}
}