Load Image Dynamically

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Load Image Dynamically

    Hi, brothers :)

    I'm rather novice in this area. I mean web programming and control building
    and though.

    I create UserControl:
    public class ucParsedPNG : System.Web.UI.UserControl
    {
    ... blah-blah-blah ...

    }

    My UserControl has to contain image and this one should be loaded
    dynamically from a stream from C# code.

    I have two files:
    ucParsedPNG.ascx
    ucParsedPNG.ascx.cs

    I'v heard that in tag <IMG> in attribute <SRC> I can specify some script.
    But all this I could do if I would use HTML. Now I'm trying to write in C#.
    What exactly should I do now to achieve needed result.

    All kind of help, hints, links and explanation will be highly appreciated!!!

    A lot of thanks in advance!!!

    Mr.Cyber Guest

  2. Similar Questions and Discussions

    1. load image dynamically into tilelist icon
      Hey all you Flex gurus, If got a httpservice set up, and my mxml app loads some XML, the data is put into a grid and a tilelist by using the...
    2. Can CSS file load dynamically?
      We have a large application. In our design, we make the whole application as one mxml application, and the other modules are the mxml components to...
    3. Best way to dynamically load jpegs?
      I am new to Flash and actionscript and just getting my feet wet learning how to put the pieces together. I would like to dynamically load series of...
    4. Dynamically load an ASP Page
      I'm pretty new to ASP.Net (server side) Suppose that I have an instance of an ASP Page class, and I want the client's web browser to load it. I...
    5. How to dynamically load new image to cast member from file..
      I'm trying to load a new image from a file into an existing cast member during run-time and I'm sure not sure how to do this. Can you help? ...
  3. #2

    Default Re: Load Image Dynamically

    Hello Mr.Cyber,

    A user control can manipulate the page's html output, add some tags etc.,
    but cannot attach another resource other than pure html. In fact, HTML is
    a text only world, where you define layout, content and resource references,
    not the resource itself.

    Having said that, your control can tell the page to look somewhere for a
    specific image but it can't just output the image with the page.

    Write another ascx or aspx, make them accept a parameter or two to get the
    stream you are looking for, have it response the image into the response
    stream, and add a reference to them in ucParsedPNG's output.

    Something like <img src="foo.aspx?imgid=1">

    ....and somewhere in foo.aspx:

    this.Response.Clear();
    this.Response.ContentType = "image/png"; // not sure about the mime type
    for png
    imageFromStream.Save(this.Response.OutputStream, _type);
    //...dispose as necessary

    I guess it should be something like this. Hope this helps.

    Gokhan Altinoren
    gokhan[RMV_this][at]altinoren[also_RMV_this][dot]com
    [url]http://altinoren.com[/url]
    > Hi, brothers :)
    >
    > I'm rather novice in this area. I mean web programming and control
    > building and though.
    >
    > I create UserControl:
    > public class ucParsedPNG : System.Web.UI.UserControl
    > {
    > ... blah-blah-blah ...
    > }
    >
    > My UserControl has to contain image and this one should be loaded
    > dynamically from a stream from C# code.
    >
    > I have two files:
    > ucParsedPNG.ascx
    > ucParsedPNG.ascx.cs
    > I'v heard that in tag <IMG> in attribute <SRC> I can specify some
    > script. But all this I could do if I would use HTML. Now I'm trying to
    > write in C#. What exactly should I do now to achieve needed result.
    >
    > All kind of help, hints, links and explanation will be highly
    > appreciated!!!
    >
    > A lot of thanks in advance!!!
    >


    Gokhan Altinoren Guest

  4. #3

    Default Load Image Dynamically

    Hi,

    I was reading your article and I would like to appreciate you for making it very simple and understandable. This article gives me a basic idea of Dynamically loading image in Image control in ASP.NET and it helped me a lot. I had found another nice post over the internet which also have a wonderful explanation on Dynamically loading image in Image control in ASP.NET.

    Thank you very much for your precious post.
    ManojBhatt Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139