setting asp.net 4.5 Treeview node forecolor dynamically in c# 4.5

Posted by Udayahcl under ASP.NET on 10/17/2014 | Points: 10 | Views : 668 | Status : [Member] | Replies : 0
Hi

I am using asp.net treeview control in my project. Here i am binding nodes to treeview at runtime. My requirement is based on the active status of record i want to change tree node forecolor. If recode is active then blue ,if recode is inactive then gray. Following is the code i wrote to bind tree node at runtime.
private void BindTreeViewMenu(DataTable dataSource)
{
if (dataSource != null)
{
if (dataSource.Rows.Count > 0)
{
tvMenu.Nodes.Clear();
foreach (DataRow masterRow in dataSource.Rows)
{
TreeNode masterNode = new TreeNode((string)masterRow["Title"]);
masterNode.Value = Convert.ToString(masterRow["SlideId"]);
tvMenu.Nodes.Add(masterNode);
}
}
}
}

Please let me know how to achieve my requirement.




Responses

(No response found.)

Login to post response