How to pop up different text base on the selected TreeNode?
How to pop up different text base on the selected TreeNode?I want to pop up different Text base on the selected TreeNode of the TreeView component. So, I create a TreeView and a ModalPopupExtender. Following is my codes.
Default.aspx
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="TreeView1"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
Default.aspx.cs
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
this.Label1.Text = this.TreeView1.SelectedNode.Value.ToString();
}
When I click the TreeView component, the panel is pop up, but the text of label in the panel is not change. Does anyone know why, and how to solve this problem?
[此贴子已经被作者于2007-10-26 8:50:37编辑过]