<ext:DropDownList Label="指定类别" AutoPostBack="true" Required="true" EnableSimulateTree="true" ShowRedStar="true" runat="server" ID="ddlBox"
OnSelectedIndexChanged="ddlBox_SelectedChange" >
</ext:DropDownList>
try
{
DataTable dt = Govaze.SQLServerDAL.Factory.getDataXmlDAL().ProcDataTable("<root><Type>simulate_tree2</Type><AID>" + TreeID.Text + "</AID></root>", "DataXmlProject");
ddlBox.DataTextField = "Name";
ddlBox.DataValueField = "Id";
ddlBox.DataSimulateTreeLevelField = "Level";
ddlBox.DataEnableSelectField = "EnableSelect";
ddlBox.EnableSimulateTree = dt.Rows.Count <= 1 ? false : true;
ddlBox.DataSource = dt;
ddlBox.DataBind();
}
catch { }
ddlBox.SelectedValue = TreeID.Text;
ELSE IF @Type='simulate_tree2'
BEGIN
SELECT @AID=@Text1.value('(root/AID)[1]', 'Int');
SELECT @HID=HID FROM dbo.ProjectSub WHERE AID=@AID
-- SELECT @HID=@HID.GetAncestor(@HID.GetLevel()-3).ToString()
--【参数】[ProjectSub 中 HID 的级别] {@TreeID=> dbo.ProjectSub.AID => dbo.ProjectSub.HID => @HID.GetAncestor(@HID.GetLevel()-3).ToString() }
SELECT AID AS Id
,ObjectName AS Name
--,(CASE HLevel WHEN 3 THEN HID.ToString() ELSE HID.GetAncestor(1).ToString() END ) AS Level
,HLevel-4 AS Level
, 'True' AS EnableSelect
FROM dbo.ProjectSub WHERE HID.IsDescendantOf(@HID)=1
ORDER BY HID
END