I have hierarchy of panel items Level1-Level2-Level3
I only have "Actions" when user selects a Level3 item. All "parent" items from Level1 and Level2 act as folders only.
I can create CSS to show which item on Level3 is selected, but I could not find how to specify CSS for the parent of selected item.
For example when user clicks on Item3 I want to change background and font color of Item3 and all of its parents (Item1 and Item2). How can I do this?
Item1
Item2
Item3
OtherItem
OtherItem
Thank you
I only have "Actions" when user selects a Level3 item. All "parent" items from Level1 and Level2 act as folders only.
I can create CSS to show which item on Level3 is selected, but I could not find how to specify CSS for the parent of selected item.
For example when user clicks on Item3 I want to change background and font color of Item3 and all of its parents (Item1 and Item2). How can I do this?
Item1
Item2
Item3
OtherItem
OtherItem
Thank you
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 23 Jan 2009, 01:11 PM
Hello Alex,
A sugeestion would be to highlight the parent items on clicking the child item as shown in the code below:
cs:
Thanks
Princy.
A sugeestion would be to highlight the parent items on clicking the child item as shown in the code below:
cs:
protected void RadPanelBar1_ItemClick(object sender, RadPanelBarEventArgs e) |
{ |
if (e.Item.Level == 2 && e.Item.Selected) |
{ |
e.Item.BackColor = System.Drawing.Color.Red; |
RadPanelItem childItem = (RadPanelItem)e.Item.Parent; |
childItem.BackColor = System.Drawing.Color.Red; |
RadPanelItem rootItem = (RadPanelItem)childItem.Parent; |
rootItem.BackColor = System.Drawing.Color.Red; |
} |
} |
Thanks
Princy.
0

Alex
Top achievements
Rank 1
answered on 23 Jan 2009, 05:12 PM
Thank you!
0

Alex
Top achievements
Rank 1
answered on 23 Jan 2009, 08:11 PM
Actually I could only make it work for background color.
I was unable to set Font weight using the same technique.
Is there a trick to set "Item.Font.Bold = true" ? It just gets ignored... Is it because Panel has skin attached and skin itself sets font weight to "normal"
I was unable to set Font weight using the same technique.
Is there a trick to set "Item.Font.Bold = true" ? It just gets ignored... Is it because Panel has skin attached and skin itself sets font weight to "normal"
0
Hi Alex,
You can set CssClass property of the items:
and in "boldClass" set the font-weight so that it will overwrite the skin style:
All the best,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can set CssClass property of the items:
e.Item.CssClass = "boldClass"; |
childItem.CssClass = "boldClass"; |
rootItem.CssClass = "boldClass"; |
and in "boldClass" set the font-weight so that it will overwrite the skin style:
<style type="text/css"> |
.boldClass { |
font-weight: bold !important; |
} |
</style> |
All the best,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.