treeview怎么样设置使点击父节点文字展开子节点,而不刷新?
我想点击父节点的文字时和点击父节的“+”一样展开子节点?这样做主要是不会刷新,我应该怎么设置呀?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindTreeView(menuTreeView, false, "0 ");
//menuTreeView.ShowExpand= true;
}
else
{
if (menuTreeView.SelectedNode.Expanded.Value)
{
menuTreeView.SelectedNode.Expanded = false;
}
else
{
menuTreeView.SelectedNode.Expanded = true;
//menuTreeView.Nodes[0].Expanded=true;
}
}
}
public DataSet GetCategorys()
{
SqlConnection conn = DB.CreateConn();
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter( "select * from admin_menu ", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
conn.Close();
return ds;
}
public void BindTreeView(TreeView treeView, bool isExpanded, string sSelectData)
{
DataTable dataTable = GetCategorys().Tables[0];
treeView.Nodes.Clear();
DataRow[] rowList = dataTable.Select( "fatherid= '0 ' ");
if (rowList.Length