Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to add an image to web user control?

How to add an image to web user control?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gyokusei
    wrote on last edited by
    #1

    Hi all, I created a control extends textbox control and I named it MyTextBox. In render method, I added an image beside the textbox like: <img src='...'>. However, when I apply it to my webpage. The image doesn't appear (The image's url depend on webapplication project). So, I want to ask you how I embed that image in my control (dll file). Thx!

    M 1 Reply Last reply
    0
    • G gyokusei

      Hi all, I created a control extends textbox control and I named it MyTextBox. In render method, I added an image beside the textbox like: <img src='...'>. However, when I apply it to my webpage. The image doesn't appear (The image's url depend on webapplication project). So, I want to ask you how I embed that image in my control (dll file). Thx!

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      + To embed the image in the control assembly, you can simply add the image file to the control project, then set the BuildAction[^] property of the file to the Embedded Resource. + To get the URL to the embeded image, you can use the GetWebResourceUrl [^] method.

      G 1 Reply Last reply
      0
      • M minhpc_bk

        + To embed the image in the control assembly, you can simply add the image file to the control project, then set the BuildAction[^] property of the file to the Embedded Resource. + To get the URL to the embeded image, you can use the GetWebResourceUrl [^] method.

        G Offline
        G Offline
        gyokusei
        wrote on last edited by
        #3

        Thank you for your reply! However, GetWebResourceUrl: This method is new in the .NET Framework version 2.0. Now I tell you the detail: I want to write a datetimepicker, it has a textbox and an image at beside. So that I create a web control extended textbox. I don't care about the image of the assembly, I just pay attention to the image beside the textbox. I want when I compile it into dll file, It will be a dependent control. The image beside the textbox doesn't belong to any projects. any suggestion?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups