积极答复者
TreeView的SelectedNodeStyle和HoverNodeStyle不能共存吗

问题
答案
-
<asp:TreeView ID="TreeView2" runat="server" HoverNodeStyle-BackColor="Green" SelectedNodeStyle-BackColor=Red > </asp:TreeView>
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TreeNode tn = new TreeNode(); tn.Text = "中国"; tn.Value = "中国"; TreeNode tn1 = new TreeNode(); tn1.Value = "河南"; tn1.Text = "河南"; tn.ChildNodes.Add(tn1); TreeNode tn2 = new TreeNode(); tn2.Value = "河北"; tn2.Text = "河北"; tn.ChildNodes.Add(tn2); TreeView2.Nodes.Add(tn); } }
我这里可以,你是怎么写的
努力+方法=成功- 已标记为答案 m s 2010年4月23日 8:15
-
<asp:TreeView ID="TreeView2" runat="server">
<SelectedNodeStyle BackColor="Red" />
<HoverNodeStyle BackColor="Green" />
</asp:TreeView>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TreeNode tn = new TreeNode();
tn.Text = "中国";
tn.Value = "中国";
TreeNode tn1 = new TreeNode();
tn1.Value = "河南";
tn1.Text = "河南";
tn.ChildNodes.Add(tn1);
TreeNode tn2 = new TreeNode();
tn2.Value = "河北";
tn2.Text = "河北";
tn.ChildNodes.Add(tn2);
TreeView2.Nodes.Add(tn);}
}
这样也可以,奇怪我的就不行
- 已标记为答案 m s 2010年4月23日 8:17
全部回复
-
<asp:TreeView ID="TreeView1" runat="server" HoverNodeStyle-BackColor="Green" SelectedNodeStyle-BackColor=Red EnableViewState="False"> <HoverNodeStyle BackColor="Green"></HoverNodeStyle> <SelectedNodeStyle BackColor="Red"></SelectedNodeStyle> <Nodes> <asp:TreeNode Text="中国" Value="中国"> <asp:TreeNode Text="河南" Value="河南" ></asp:TreeNode> <asp:TreeNode Text="河北" Value="河北"></asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView>
努力+方法=成功 -
<asp:TreeView ID="TreeView2" runat="server" HoverNodeStyle-BackColor="Green" SelectedNodeStyle-BackColor=Red > </asp:TreeView>
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TreeNode tn = new TreeNode(); tn.Text = "中国"; tn.Value = "中国"; TreeNode tn1 = new TreeNode(); tn1.Value = "河南"; tn1.Text = "河南"; tn.ChildNodes.Add(tn1); TreeNode tn2 = new TreeNode(); tn2.Value = "河北"; tn2.Text = "河北"; tn.ChildNodes.Add(tn2); TreeView2.Nodes.Add(tn); } }
我这里可以,你是怎么写的
努力+方法=成功- 已标记为答案 m s 2010年4月23日 8:15
-
<asp:TreeView ID="TreeView2" runat="server">
<SelectedNodeStyle BackColor="Red" />
<HoverNodeStyle BackColor="Green" />
</asp:TreeView>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TreeNode tn = new TreeNode();
tn.Text = "中国";
tn.Value = "中国";
TreeNode tn1 = new TreeNode();
tn1.Value = "河南";
tn1.Text = "河南";
tn.ChildNodes.Add(tn1);
TreeNode tn2 = new TreeNode();
tn2.Value = "河北";
tn2.Text = "河北";
tn.ChildNodes.Add(tn2);
TreeView2.Nodes.Add(tn);}
}
这样也可以,奇怪我的就不行
- 已标记为答案 m s 2010年4月23日 8:17