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

Databound nodes and SkinID

4 Answers 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kevin Schneider
Top achievements
Rank 1
Kevin Schneider asked on 26 Jan 2009, 06:32 PM
The application I am building is using .NET theme files to properly apply skins to various elements.  My problem is simple:

In my skin file I have some items as follows:


 
<Telerik:RadTreeNode runat="server" SkinID="District" ImageUrl="images/icons/folder.gif" /> 
 <Telerik:RadTreeNode runat="server" SkinID="Location" ImageUrl="images/icons/house.gif" /> 

What I would like to do, is based on the data being bound to the treeview is assign a different SkinID to each node as they are created.

My problem is that the 2 events I have to work with, NodeCreated and NodeDataBound, won't accomplish this.  NodeCreated is too early because I can't determine the type of node being created because the DataItem value of e.Node is null.  NodeDataBound is too late because the node has already been added to the Controls collection and the SkinID cannot be assigned.

How would I go about accomplishing this?

Thanks

 

 

 

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Jan 2009, 06:36 PM
Hi Kevin Schneider,

Indeed this is currently not supported. The only workaround I can think of is to set the ImageUrl based on the dataitem during the NodeBound event.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kevin Schneider
Top achievements
Rank 1
answered on 26 Jan 2009, 06:48 PM
Doing it this way completely voids the point of using themes in the first place...

Is there a way to have the image rendered out with no src value?  Then I could at least assign a css class and set its values that way.

Thanks
0
Atanas Korchev
Telerik team
answered on 27 Jan 2009, 07:49 AM
Hi Kevin Schneider,

The image is only rendered when the ImageUrl property is set. However you can use the CssClass or ContentCssClass properties to set custom CSS class for your nodes. However you still would need to determine via code the specific type of node which is the same as assigning SkinID, ImageUrl etc.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sypher
Top achievements
Rank 1
answered on 12 Feb 2009, 09:57 PM
The SkinID for RadTreeNodes doesn't work.  I have no idea why that shows up there and isn't used.  We use themes and .skin files as well with the Telerik products and have just had to put up with their partial support of themes.

In many cases, we have to set the ImageUrl in code with something like "~/App_Themes/" + Page.Theme + "/images/" + Filename.

Also, remember that in skin files, most of the time you can use relative paths to the images, like "images/image.png", but that doesn't work in Telerik objects.  For them, you need to put in the full "~/App_Themes/ThemeName/images/image.png".  That isn't as much of a problem for use since the skin file is in the theme directory and only needs to point to one theme, but it's something to keep in mind.

Both of these problems would be easy for Telerik to fix if they looked into how to work with themes.
Tags
TreeView
Asked by
Kevin Schneider
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Kevin Schneider
Top achievements
Rank 1
Sypher
Top achievements
Rank 1
Share this question
or