FineUI.Tree相关的Detail页面的绑定操作
2017-02-23 13:05:57 访问(1632) 赞(0) 踩(0)
-
<x:FormRow ID="FormRow6" runat="server">
<Items>
<x:Label ID="tree1" runat="server" Label="检查内容">
</x:Label>
</Items>
</x:FormRow>
<x:FormRow ID="FormRow5" runat="server">
<Items>
<x:Tree ID="tree_ZKB_JCNR_Ids" AutoScroll="true" runat="server" ShowHeader="false" Height="300px">
</x:Tree>
</Items>
</x:FormRow>
-
/// <summary>
///
/// </summary>
/// <param name="xdbHelper"></param>
protected void DataBindFwgwTree(DBHelper xdbHelper)
{
eKingSzdfLibHelper
ch
=
eKingSzdfLibHelper.cInstance;
List<eKing.SzdfLib.Model.JYGL.UTB_SZDF_JYGL_FWGW>
theList
=
ch.JyglWfgwModelListAll(false, xdbHelper);
tree_FWGW_Ids.Nodes.Clear();
DataBindFwgwTreeNodes(0, theList, tree_FWGW_Ids.Nodes, xdbHelper);
tree_FWGW_Ids.ExpandAllNodes();
}
/// <summary>
///
/// </summary>
/// <param name="tnc"></param>
protected void FineUITreeClearCheck(FineUI.TreeNodeCollection tnc)
{
foreach (FineUI.TreeNode tn in tnc)
{
if (tn.EnableCheckBox)
{
tn.Checked = false;
}
FineUITreeClearCheck(tn.Nodes);
}
}
/// <summary>
///
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string TreeNodeIdToId(string str)
{
int idx = str.IndexOf('_');
if (idx == -1)
return str;
return str.Substring(idx + 1);
}
/// <summary>
///
/// </summary>
/// <param name="tnc"></param>
protected void FineUITreeSetCheck
(
FineUI.TreeNodeCollection tnc,
string strIds
)
{
foreach (FineUI.TreeNode tn in tnc)
{
string curId = TreeNodeIdToId(tn.NodeID);
if (tn.EnableCheckBox)
{
if (("," + strIds + ",").Contains("," + curId + ","))
{
tn.Checked = true;
}
else
{
tn.Checked = false;
}
}
FineUITreeSetCheck(tn.Nodes, strIds);
}
}
/// <summary>
///
/// </summary>
/// <param name="pId"></param>
/// <param name="theList"></param>
/// <param name="tnc"></param>
/// <param name="xdbHelper"></param>
protected void DataBindFwgwTreeNodes
(
long pId,
List<eKing.SzdfLib.Model.JYGL.UTB_SZDF_JYGL_FWGW> theList,
FineUI.TreeNodeCollection tnc,
DBHelper xdbHelper
)
{
eKingSzdfLibHelper
ch
=
eKingSzdfLibHelper.cInstance;
FineUI.TreeNode tn = null;
bool isLeaf = true;
foreach (eKing.SzdfLib.Model.JYGL.UTB_SZDF_JYGL_FWGW model in theList)
{
if (model.PID != pId)
continue;
tn = new FineUI.TreeNode();
tn.NodeID = "n_" + model.ID.ToString();
tn.Text = model.TheName;
tnc.Add(tn);
if (model.Remark != null && model.Remark.Length > 0)
{
tn.ToolTip = model.Remark;
}
isLeaf = ch.JyglWfgwModelIsLeaf(model.ID, theList);
if (isLeaf)
{
tn.EnableCheckBox = true;
continue;
}
DataBindFwgwTreeNodes(model.ID, theList, tn.Nodes, xdbHelper);
}
}
-
public string ListLongToIds(List<long> theList)
{
if (theList == null || theList.Count == 0)
return "";
StringBuilder sb = new StringBuilder();
bool isFirst = true;
foreach (long curId in theList)
{
if (isFirst)
isFirst = false;
else
sb.Append(",");
sb.Append(curId.ToString());
}
return sb.ToString();
}
/// <summary>
///
/// </summary>
/// <param name="fTree"></param>
/// <returns></returns>
protected List<long> NodeCheckIdList(FineUI.Tree fTree)
{
List<long> theResult = new List<long>();
NodeCheckIdListBuild(theResult, fTree.Nodes);
return theResult;
}
/// <summary>
///
/// </summary>
/// <param name="fTree"></param>
/// <returns></returns>
protected void NodeCheckIdListBuild(List<long> theResult, FineUI.TreeNodeCollection tnc)
{
eKingSzdfLibHelper
ch
=
eKingSzdfLibHelper.cInstance;
foreach (FineUI.TreeNode tn in tnc)
{
if (tn.Checked)
{
string strId = tn.NodeID;
int idx = strId.IndexOf('_');
if (idx != -1)
{
long theValue = ch.LongByStr(strId.Substring(idx + 1), 0);
if (theValue != 0)
theResult.Add(theValue);
}
}
NodeCheckIdListBuild(theResult, tn.Nodes);
}
}
标签:
FineUI.Tree相关的Detail页面的绑定操作 


上一条:
下一条:
相关评论
发表评论