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. display text instead of image

display text instead of image

Scheduled Pinned Locked Moved ASP.NET
databasehelp
10 Posts 4 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.
  • S Offline
    S Offline
    sra22
    wrote on last edited by
    #1

    Hi, I want to display some text inplace of image if image is not available, when we are retrieving image from database. anyone help me

    S H 2 Replies Last reply
    0
    • S sra22

      Hi, I want to display some text inplace of image if image is not available, when we are retrieving image from database. anyone help me

      S Offline
      S Offline
      Sherin Iranimose
      wrote on last edited by
      #2

      Hi, What is the problem. Where you are displaying image. Can you figure out problem more Specifically..


      To succeed, we must first believe that we can. Sherin Iranimose


      S 1 Reply Last reply
      0
      • S sra22

        Hi, I want to display some text inplace of image if image is not available, when we are retrieving image from database. anyone help me

        H Offline
        H Offline
        Harini N K
        wrote on last edited by
        #3

        Hi There is one attribute called as 'ALT' tag to describe your image. This means, that the text is meant to be used when the image is not visible on the page. Hope you got it. :)

        Harini

        1 Reply Last reply
        0
        • S Sherin Iranimose

          Hi, What is the problem. Where you are displaying image. Can you figure out problem more Specifically..


          To succeed, we must first believe that we can. Sherin Iranimose


          S Offline
          S Offline
          sra22
          wrote on last edited by
          #4

          Hi, I want to display that image in one form Just i want to display Image not available if there is no record in the database is it clear?

          S 1 Reply Last reply
          0
          • S sra22

            Hi, I want to display that image in one form Just i want to display Image not available if there is no record in the database is it clear?

            S Offline
            S Offline
            Sherin Iranimose
            wrote on last edited by
            #5

            hi There is a property for asp Image control called altername text. This text will display if no image url specified. So set the url for ur image if it is availble only.


            To succeed, we must first believe that we can. Sherin Iranimose


            S 1 Reply Last reply
            0
            • S Sherin Iranimose

              hi There is a property for asp Image control called altername text. This text will display if no image url specified. So set the url for ur image if it is availble only.


              To succeed, we must first believe that we can. Sherin Iranimose


              S Offline
              S Offline
              sra22
              wrote on last edited by
              #6

              Hi, But it is showing inside the image. I want to display outside

              N 1 Reply Last reply
              0
              • S sra22

                Hi, But it is showing inside the image. I want to display outside

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                Write a function that checks the database value is empty. If empty then replace that with another image not found image. If you are binding data on datagrid then use itemdatabound event for setting the image.

                private string GetImagePath(string DbValue)
                {
                string strReturn = string.Empty;
                if ( DbValue == "" ){
                strReturn = "YourNotFoundImage.gif";
                }
                else
                strReturn = "CorrrectImage.gif";
                }

                Call a function like this when data is binding from DB

                Navaneeth My Website

                S 1 Reply Last reply
                0
                • N N a v a n e e t h

                  Write a function that checks the database value is empty. If empty then replace that with another image not found image. If you are binding data on datagrid then use itemdatabound event for setting the image.

                  private string GetImagePath(string DbValue)
                  {
                  string strReturn = string.Empty;
                  if ( DbValue == "" ){
                  strReturn = "YourNotFoundImage.gif";
                  }
                  else
                  strReturn = "CorrrectImage.gif";
                  }

                  Call a function like this when data is binding from DB

                  Navaneeth My Website

                  S Offline
                  S Offline
                  sra22
                  wrote on last edited by
                  #8

                  Hi, Thanks for u'r reply. But I am storing image as binary format in sql & retrieving like this . see this code Do While (myDataReader.Read()) Response.ContentType = myDataReader.Item(1) Response.BinaryWrite(myDataReader.Item(0)) Loop So How can i check recordcount

                  S N 2 Replies Last reply
                  0
                  • S sra22

                    Hi, Thanks for u'r reply. But I am storing image as binary format in sql & retrieving like this . see this code Do While (myDataReader.Read()) Response.ContentType = myDataReader.Item(1) Response.BinaryWrite(myDataReader.Item(0)) Loop So How can i check recordcount

                    S Offline
                    S Offline
                    Sherin Iranimose
                    wrote on last edited by
                    #9

                    Hi, How you are checking image available or not the same method you can use in navaneeth's example...


                    To succeed, we must first believe that we can. Sherin Iranimose


                    1 Reply Last reply
                    0
                    • S sra22

                      Hi, Thanks for u'r reply. But I am storing image as binary format in sql & retrieving like this . see this code Do While (myDataReader.Read()) Response.ContentType = myDataReader.Item(1) Response.BinaryWrite(myDataReader.Item(0)) Loop So How can i check recordcount

                      N Offline
                      N Offline
                      N a v a n e e t h
                      wrote on last edited by
                      #10

                      What about converting binary to string and passing to the function ? Try This Link[^]

                      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