Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 602659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:50:46+00:00 2026-05-13T16:50:46+00:00

I am going to create a web server control representing a treeview. So I

  • 0

I am going to create a web server control representing a treeview. So I want to use 2 images for + and – for expand/collapse. How can I build this into the control in a way that can be used as image source when rendered on the page?

Since this will be in a compiled web controls library, I don’t want to rely on external images in the web application.

Edit:
Based on this answer by Andre Kraemer I did the following:

In AssemblyInfo.vb:

<Assembly: System.Web.UI.WebResource("MyCompany.MyWebControls.Resources.plus.gif", "image/gif")> 
<Assembly: System.Web.UI.WebResource("MyCompany.MyWebControls.Resources.minus.gif", "image/gif")> 

In my RenderContents override:

Dim lPlusImage As New WebControls.Image()
Dim lMinusImage As New WebControls.Image()
lPlusImage.ImageUrl = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "MyCompany.MyWebControls.Resources.plus.gif")
lMinusImage.ImageUrl = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "MyCompany.MyWebControls.Resources.minus.gif")
lPlusImage.RenderControl(output)
lMinusImage.RenderControl(output)

My Assembly name is MyWebControls.

My Root Namespace is MyCompany.MyWebControls.

The images plus.gif and minus.gif are located in a folder named Resources, and the images have Build Action set to Embedded Resource.

It still does not work. I get no errors. I have tried the generated image url directly in the browser, bot nothing happens, just a blank page.

Note:
I tried to use an invalid path in the resource name, and the result was exactly the same, which made me wonder if I need to do something special to map the actual resource to the resource name. I got a 404 Not Found error only if I used different name in the code than what was specified in AssemblyInfo, it had nothing to do with path was pointing to an actual resource!

Edit:

I found the solution!

I found out that it is a difference between C# and VB. See my own answer to this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:50:46+00:00Added an answer on May 13, 2026 at 4:50 pm

    add the two images to a subfolder called images of your treeview control project. Then change their build action in the property grid from content to embedded resource.

    In addition to that, you have to register those two images as embedded resources for your assembly in the assemblyinfo.cs file like this:

    [assembly: System.Web.UI.WebResource("YourProjectsNameSpace.Images.plus.gif", "img/gif")]
    [assembly: System.Web.UI.WebResource("YourProjectsNameSpace.Images.minus.gif", "img/gif")]
    

    As those images will be embedded into your controls assembly now, you can access them using the ClientScriptManager like this:

    string plusImageUrl  = Page.ClientScript.GetWebResourceUrl(this.GetType(), "YourProjectsNameSpace.Images.plus.gif");
    string minusImageUrl  = Page.ClientScript.GetWebResourceUrl(this.GetType(), "YourProjectsNameSpace.Images.minus.gif");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 291k
  • Answers 291k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Querysets are not serializable out-of-the-box. If you try list(self.items) instead… May 13, 2026 at 5:59 pm
  • Editorial Team
    Editorial Team added an answer Yes it's possible. Close a tab and hit the left… May 13, 2026 at 5:59 pm
  • Editorial Team
    Editorial Team added an answer They will generate the same IL. Use whichever you find… May 13, 2026 at 5:59 pm

Related Questions

I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
I am developing a website using SQL Server Express on my development machine. My
In the past I've done web application development using Visual Studio. Initially I'd use
I have designed database tables (normalised, on an MS SQL server) and created a
What is the preferred way to create a background task for a Rails application?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.