首页 新闻 会员 周边 捐助

dataview 中Sort排序无效

0
[已关闭问题]
代码
private DataTable table = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
Bind();
}

}
private void ShowTreeView(string nodeId, TreeNode nodeTemp)
{
DataView dv
= table.DefaultView;
dv.RowFilter
= string.Format("PARENT_NODE ='{0}'", nodeId);
dv.Sort
= "ORDER_NO ASC";
foreach (DataRowView drv in dv)
{
TreeListNode node
= new TreeListNode();
node.Text
= drv["TASK_NAME"].ToString();
node.Value
= drv["NODE_ID"].ToString();
node.ShowCheckBox
= _ShowCheckBox;
node.RowInfo.ID
= drv["TEMPLATE_ID"].ToString();
node.OnCheckedFunName
= "onCheckNode";
node.RowInfo.Attributes.Add(
"onmouseover", "onMouseOver(this);");
node.RowInfo.Attributes.Add(
"onmouseout", "onMouseOut(this);");
TreeListColumn td0
= new TreeListColumn(drv["TASK_NAME"].ToString());
td0.CssClass
= "FileListtd";
td0.Width
= "800px";
node.Columns.Add(td0);

if (nodeId == "0")
{
this.tree.Nodes.Add(node);
}
else
{
nodeTemp.ChildNodes.Add(node);
}
ShowTreeView(node.Value, node);
}
}

 

     private void Bind()
    {
        table = new SqlHelper().R_DT(string.Format(@"select template_id,node_id,order_no,parent_node,task_name from TIMING_TEMPLATE order by ORDER_NO"), "dt");
        DataView dv = table.DefaultView;
        dv.RowFilter = "PARENT_NODE ='0'";
        ShowTreeView("0", null);
    }

在跟踪的时候发现第一次是有效的,但是以后就无效的,求救了~~~

like%'远远'%的主页 like%'远远'% | 小虾三级 | 园豆:635
提问于:2010-04-28 16:55
< >
分享
其他回答(1)
0

用DataView dv = dt.Select("filter","sort");试试吧

上不了岸的鱼 | 园豆:4613 (老鸟四级) | 2010-04-28 17:02
0
if (!IsPostBack)
{
Bind();//回发后是不会再执行了
}
Astar | 园豆:40805 (高人七级) | 2010-04-28 17:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册