求高手回答关于asp.net程序代码问题
publicvoidBindCategoryTree(TreeViewtreeView,boolisExpanded,stringsSelectedData){Categ...
public void BindCategoryTree(TreeView treeView, bool isExpanded, string sSelectedData)
{
Category category = new Category();
DataTable dataTable = SystemTools.ConvertDataReaderToDataTable(category.GetCategorys());/这行出现问题
treeView.Nodes.Clear();
DataRow[] rowList = dataTable.Select("ParentID='-1'");
if (rowList.Length <= 0) return;
TreeNode rootNode = new TreeNode();
rootNode.Text = rowList[0]["Desn"].ToString();
rootNode.Value = rowList[0]["CategoryID"].ToString();
rootNode.Expanded = isExpanded;
rootNode.Selected = true;
rootNode.NavigateUrl = rowList[0]["Url"].ToString() + "?CategoryID=" + rowList[0]["CategoryID"].ToString();
rootNode.Target = "MainFrame";
treeView.Nodes.Add(rootNode);
CreateSubNode(rootNode, dataTable, isExpanded, sSelectedData);
} 展开
{
Category category = new Category();
DataTable dataTable = SystemTools.ConvertDataReaderToDataTable(category.GetCategorys());/这行出现问题
treeView.Nodes.Clear();
DataRow[] rowList = dataTable.Select("ParentID='-1'");
if (rowList.Length <= 0) return;
TreeNode rootNode = new TreeNode();
rootNode.Text = rowList[0]["Desn"].ToString();
rootNode.Value = rowList[0]["CategoryID"].ToString();
rootNode.Expanded = isExpanded;
rootNode.Selected = true;
rootNode.NavigateUrl = rowList[0]["Url"].ToString() + "?CategoryID=" + rowList[0]["CategoryID"].ToString();
rootNode.Target = "MainFrame";
treeView.Nodes.Add(rootNode);
CreateSubNode(rootNode, dataTable, isExpanded, sSelectedData);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询