Image Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veenna
    New Member
    • Dec 2007
    • 65

    Image Control

    hai,


    I have one image control in aspx page. and i am assigning image url as follows

    Code:
    <asp:Image ID="imgmuseum" runat="server" ImageUrl='<%#"WebForm1.aspx?id=" + Eval("id")  %>' />

    And i have written some code in WebForm1 page load. But it is not redirecting to Webform1.So, i want to know whether it will redirect or not?
    Or anything wrong in the above code?


    thanks,
    Veena
  • ssnaik84
    New Member
    • Aug 2009
    • 149

    #2
    redirect??
    use ImageButton instead... with PostBackUrl property.

    ImageUrl is used to set image path, not page url.

    Comment

    • veenna
      New Member
      • Dec 2007
      • 65

      #3
      thank u for ur reply...

      on click of image i dont want to redirect to some other page.

      i am storing image in database. and from db i am getting byte array and using Response.Binary Write(image); i am writing that image in webform1.aspx.

      and for image control if i give webform1.aspx as image url it should display that image ..

      In case of sigle image control it is working fine.. But now i want to display images in repeater control.In repeater it is not displaying any images.

      regards,
      veena

      Comment

      • ssnaik84
        New Member
        • Aug 2009
        • 149

        #4
        have you set page header to bmp/jpg before writing image

        Code:
        Response.ContentType = "image/bmp"
        i dont know it will work but try this..

        Code:
        ImageUrl='WebForm1.aspx?id=" + <%# Eval("id")  %>'

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Originally posted by veenna

          In case of sigle image control it is working fine.. But now i want to display images in repeater control.In repeater it is not displaying any images.
          Hi Veena,

          Try changing it to:

          <asp:Image runat="server" ImageUrl='WebFo rm1.aspx?id=<%# Eval("id") %>' />

          Comment

          • ssnaik84
            New Member
            • Aug 2009
            • 149

            #6
            thanks for correcting me Frinny..
            by the way, in such situation, we should create handler .ashx instead of .aspx.. what say?

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Well in this case the OP has probably implemented the aspx page in such a way that it returns images to the browser based on the ID passed as the parameter in the query string. I've done this many times...the aspx page could provide smaller, thumbnail images instead of full size images and/or the page could be retrieving the image from a database.

              Since the image is being returned in order to display it in the web browser it should probably remain an aspx page.

              ashx pages are meant to return data to some other xml consuming application as apposed to the web browser.

              -Frinny

              Comment

              • veenna
                New Member
                • Dec 2007
                • 65

                #8
                hi,

                i resolved this issue by assigning the image url from item databound event of repeater control. and i think Frinavale solution also wil work.

                thanks for all those who replyed.

                regards,
                veena

                Comment

                Working...