Changing Treeview property

Discussion in 'ASP .Net' started by Mike Collins, Jul 1, 2008.

  1. Mike Collins

    Mike Collins Guest

    I have six treeviews on a page. Each one is nested inside an accordion pane.
    When I click on a node, it turns yellow. When I click on a node in another
    tree, I would like the previous selected node to change back from yellow to
    its original color. The two different ways I have tried below do not work. Am
    I doing something wrong?

    Code (Text):

    protected void tvAccountSetup_SelectedNodeChanged(object sender, EventArgs e)
    {
        string cssStyle = "color: #FFFFFF; background: none;
    font-size:12pt;font-weight:bold;";
        tvProgram.SelectedNodeStyle.CssClass = cssStyle;
        if (tvProgram.SelectedNode != null)
        {
            tvProgram.SelectedNodeStyle.BackColor = System.Drawing.Color.Beige;
            tvProgram.SelectedNode.Selected = false;
        }
    }

     
     
    Mike Collins, Jul 1, 2008
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bHdoaXRiMQ==?=

    changing icons on Treeview control

    =?Utf-8?B?bHdoaXRiMQ==?=, Oct 27, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    5,299
    =?Utf-8?B?bHdoaXRiMQ==?=
    Oct 28, 2005
  2. =?Utf-8?B?VHltYm93?=
    Replies:
    2
    Views:
    25,261
    =?Utf-8?B?VHltYm93?=
    Jan 10, 2006
  3. gilak
    Replies:
    2
    Views:
    407
    gilak
    Aug 20, 2007
  4. Mike Collins
    Replies:
    1
    Views:
    2,478
    bruce barker
    Jul 18, 2008
  5. abargaddon
    Replies:
    0
    Views:
    1,264
    abargaddon
    Jan 17, 2008
  6. Per Salmi

    TreeView not rendering nodes? Cacheing of a TreeView

    Per Salmi, Oct 15, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    671
    Steve Drake
    Oct 15, 2003
  7. Ionutz
    Replies:
    2
    Views:
    831
    Ionutz
    Oct 23, 2005
  8. stepkurt

    Microsoft Treeview vs System Treeview

    stepkurt, Aug 29, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    639
    Teemu Keiski
    Sep 2, 2007
Loading...