TreeNodeType type;
type = new TreeNodeType();
开发者_如何学Python type.Type = "folder";
type.ImageUrl = "Images/" + "folder.gif";
type.ExpandedImageUrl = "Images/" + "folderopen.gif";
i dont know how this image tag comes.. and how to chage that...
If your image directory is in the root of the application you should use the tilde character '~' at the start:
type.ImageUrl = "~/Images/" + "folder.gif";
you should include the full path to the image from the root, so if the image is in Content/Images:
type.ImageUrl = "~/Content/Images/" + "folder.gif";
At runtime, the '~/' is translated to the correct path to the image and rendered to the page.
If this is not working, you need to post the relevant markup of the page and the codebehind. Alos, it would help if you rightclick the image in IE and slect properties. You can see the expected path there. Or open the page in Firefox, with the Firebug Addon installed, right click the image and select Inspect Element. This will show you the path that was rendered and you can compare this to where the image actually is in your project.
精彩评论