温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:破竹CMS4.0免安装版源码
1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using Pozhu.CMS.PropertyDefinitions; 12
using Pozhu.Sites; 13
using Pozhu.CMS.Documents; 14
using Pozhu.Common.Utilities; 15
using Pozhu.Common; 16
using Pozhu.CMS.UI.UserControls.PropertyControls; 17
using Pozhu.CMS.Web; 18
19
public partial class admin_PropertyDefinition_PropertyControlSetting : AdminPageBase 20
{ 21
protected void Page_Load(object sender, EventArgs e) 22
{ 23
if (!Page.IsPostBack) 24
{ 25
int propertyDefinitionID = int.Parse(Request.QueryString["PropertyDefinitionID"]); 26
ArrayList controls = PropertyDefinitionControllerBase.GetPropertyControls(SiteController.GetCurrentSite().SiteID); 27
DocumentPropertyDefinitionController objController = new DocumentPropertyDefinitionController(); 28
PropertyDefinition property = objController.GetProperty(propertyDefinitionID); 29
foreach (PropertyControl control in controls) 30
{ 31
if (control.ApplyType == property.PropertyType) 32
{ 33
ddlControls.Items.Add(new ListItem(control.FriendlyName, control.PropertyControlID.ToString())); 34
} 35
} 36
ddlControls.Items.Insert(0, new ListItem("请选择一个控件", "-1")); 37
38
// 39
PropertyControlSetting pcs = PropertyDefinitionControllerBase.GetPropertyControlSettingByPropertyID(propertyDefinitionID); 40
if (pcs != null) 41
{ 42
PropertyControl propertyControl = PropertyDefinitionControllerBase.GetPropertyControl(pcs.PropertyControlID); 43
if (propertyControl.ApplyType == property.PropertyType) 44
{ 45
phSettingSrc.AddUserControl( propertyControl.SettingControlSrc); 46
ddlControls.SelectedValue = propertyControl.PropertyControlID.ToString(); 47
} 48
} 49
} 50
51
if (ddlControls.SelectedIndex == 0) 52
{ 53
lbtnSave.Enabled = false; 54
lbtnDelete.Enabled = false; 55
phSettingSrc.Controls.Clear(); 56
} 57
else 58
{ 59
lbtnDelete.Enabled = true; 60
lbtnSave.Enabled = true; 61
} 62
} 63
protected void lbtnCancel_Click(object sender, EventArgs e) 64
{ 65
string identify = Request.QueryString["Identify"]; 66
67
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 68
69
} 70
protected void lbtnDelete_Click(object sender, EventArgs e) 71
{ 72
string identify = Request.QueryString["Identify"]; 73
int propertyDefinitionID = int.Parse(Request.QueryString["PropertyDefinitionID"]); 74
PropertyDefinitionControllerBase.DeletePropertyControlSetting(propertyDefinitionID); 75
76
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 77
78
} 79
protected void lbtnSave_Click(object sender, EventArgs e) 80
{ 81
string identify = Request.QueryString["Identify"]; 82
int propertyDefinitionID = int.Parse(Request.QueryString["PropertyDefinitionID"]); 83
int propertyControlID = int.Parse(ddlControls.SelectedValue); 84
SettingControlBase settingControl = (SettingControlBase)phSettingSrc.Controls[0]; 85
PropertyDefinitionControllerBase.SavePropertyControlSetting(propertyDefinitionID, propertyControlID, settingControl.GetSettingXmlData()); 86
87
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 88
} 89
protected void ddlControls_SelectedIndexChanged(object sender, EventArgs e) 90
{ 91
if (ddlControls.SelectedIndex != 0) 92
{ 93
int propertyDefinitionID = int.Parse(Request.QueryString["PropertyDefinitionID"]) ; 94
int propertyControlID = int.Parse(ddlControls.SelectedValue); 95
PropertyControl propertyControl = PropertyDefinitionControllerBase.GetPropertyControl(propertyControlID); 96
phSettingSrc.Controls.Clear(); 97
phSettingSrc.AddUserControl(propertyControl.SettingControlSrc); 98
} 99
} 100
} 101





}
}