树型结构中怎么响应事件

mbh0210 2005-07-22 09:48:20
树型结构是通过读取数据库中的数据来实现的,怎么在我点击节点的时候执行一些事件.
...全文
161 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
up
fanruinet 2005-07-22
  • 打赏
  • 举报
回复
得把treeview的AutoPostBack设置为true才行
mbh0210 2005-07-22
  • 打赏
  • 举报
回复
我用SelectedIndexChange事件,当点击的时候弹出一个对话框,但运行之后点击节点,没有对话框....
lyb_abiandbel 2005-07-22
  • 打赏
  • 举报
回复
mark
silverseven7 2005-07-22
  • 打赏
  • 举报
回复
#region Tree Selected
/// <summary>
/// Tree Selection Change
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tvDocDir_SelectedIndexChange(object sender, Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs e)
{
this.SetPageView(MainPageStatus.ViewStatusInit);

try
{
TreeNode node = TreeOperationDB.GetNodeId(this.tvDocDir);

int right = this.GetCurrentNodeRight(node.ID);
if( right < 1 )
{
// Users dont have read permission
return;
}
else if( right < 2 )
{
// Only Read
this.dgDocDetail.Columns[5].Visible = false;
this.btnAddDoc.Visible = false;
}
else if( right < 3 )
{
// Update
this.dgDocDetail.Columns[5].Visible = false;
this.btnAddDoc.Visible = true;
}
else
{
this.dgDocDetail.Columns[5].Visible = true;
this.btnAddDoc.Visible = true;
}

this.Session["DocumentList"] = null;
DataTable dtDocDetail = this.GetDocumentList();

if( dtDocDetail.Rows.Count == 0 )
{
this.DivDocDetail.Visible = false;
}
else
{
this.DivDocDetail.Visible = true;
dgDocDetail.DataSource = dtDocDetail;
dgDocDetail.DataBind();
}

this.SetPageView(MainPageStatus.ViewStatusFileList);
}
catch( ApplicationException ex )
{
if( ex.Message == "1060")
{
this.NodeLostManagement( ex.Message );
}
else if( ex.Message == "1062" )
{
// TreeNode Has been Modifiey
this.ShowMessage(this.GetMessage(ex.Message));

// Rebuild Tree
string treePath = this.tvDocDir.SelectedNodeIndex;
this.rebuildTree(treePath);

this.tvDocDir_SelectedIndexChange( new object() , new Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs("0","0") );
}
}
fanruinet 2005-07-22
  • 打赏
  • 举报
回复
怎么不发到ASP.NET区?发在这里也该说明白
用SelectedIndexChange事件
mbh0210 2005-07-22
  • 打赏
  • 举报
回复
没有这些事件,是在asp.net下的
fanruinet 2005-07-22
  • 打赏
  • 举报
回复
用BeforeSelect或者AfterSelect事件就可以
mbh0210 2005-07-22
  • 打赏
  • 举报
回复
嗯,先谢谢了,只是刷新很烦恼的......
ycy589 2005-07-22
  • 打赏
  • 举报
回复
学习

111,096

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧