Databound nodes and SkinID

5 posts, 0 answers
  1. Kevin Schneider
    Kevin Schneider avatar
    48 posts
    Member since:
    Jan 2008

    Posted 26 Jan 2009 Link to this post

    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

     

     

     

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 26 Jan 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin Schneider
    Kevin Schneider avatar
    48 posts
    Member since:
    Jan 2008

    Posted 26 Jan 2009 Link to this post

    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
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 27 Jan 2009 Link to this post

    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.
  6. Sypher
    Sypher avatar
    79 posts
    Member since:
    Aug 2006

    Posted 12 Feb 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017