This is a migrated thread and some comments may be shown as answers.

loosing node color on client-side node drag/drop

1 Answer 46 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Denis
Top achievements
Rank 1
Denis asked on 09 Sep 2009, 04:16 PM
Hello,

I've a standard radtreeview control populated on the server side by sql datas. Depending on the node type i set the node ForeColor property. When i do a client-side drag/drop i'm loosing the node color. It's probably a newbee question but how can i keep the original node color ?

Thanks in advance for the help.
Denis

1 Answer, 1 is accepted

Sort by
0
Clyde
Top achievements
Rank 1
answered on 28 Jan 2013, 02:19 AM
The solution is to rather set the node.CssClass to equal a CSS style that has the color you want.

For my requirements, I needed nodes that opened in a new browser window in green. I had client side drag and drop, as well as new node creation.

Create a style for your page
.greenNode {
    color: green;
}

Then in your code behind, simply assign the node the style.

protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
{
    DataRowView dbRow = (DataRowView)e.Node.DataItem;
 
    e.Node.Attributes["UrlTarget"] = dbRow["UrlTargetNewWindow"].ToString();
    if (Convert.ToBoolean(dbRow["UrlTargetNewWindow"]))
    {
        e.Node.CssClass = "greenNode";
    }
}

The CCS style is retained with the node when dragging and dropping.
Tags
TreeView
Asked by
Denis
Top achievements
Rank 1
Answers by
Clyde
Top achievements
Rank 1
Share this question
or