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 assign a web.Config value to imageurl in ImageButton?

How to assign a web.Config value to imageurl in ImageButton?

Scheduled Pinned Locked Moved ASP.NET
questionhelptutorial
9 Posts 3 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
    Sam M
    wrote on last edited by
    #1

    Hi there, I've created a webpage which contains Imagebutton. This image path will be changable, so i want to put in web.Config file. Now how can i assign imageurl? Am using the code as: ImageUrl='<%= ConfigurationManager.AppSettings["ImagePath"]%>navigation_02.jpg' But image is not displaying and i got source code generated for this aspx page is: <input type="image" name="ctl00$ImgBtnAppt" id="ctl00_ImgBtnAppt" src="&lt;%=%20ConfigurationManager.AppSettings[&quot;ImagePath&quot;]%>navigation_02.jpg" style="border-width:0px;" /> Please help..!! How could i asign?

    Regards n Thks Sam.M

    C 1 Reply Last reply
    0
    • S Sam M

      Hi there, I've created a webpage which contains Imagebutton. This image path will be changable, so i want to put in web.Config file. Now how can i assign imageurl? Am using the code as: ImageUrl='<%= ConfigurationManager.AppSettings["ImagePath"]%>navigation_02.jpg' But image is not displaying and i got source code generated for this aspx page is: <input type="image" name="ctl00$ImgBtnAppt" id="ctl00_ImgBtnAppt" src="&lt;%=%20ConfigurationManager.AppSettings[&quot;ImagePath&quot;]%>navigation_02.jpg" style="border-width:0px;" /> Please help..!! How could i asign?

      Regards n Thks Sam.M

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      you could try an img tag, or set the value in your code behind.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      S 1 Reply Last reply
      0
      • C Christian Graus

        you could try an img tag, or set the value in your code behind.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        S Offline
        S Offline
        Sam M
        wrote on last edited by
        #3

        I dont want to assign this in code behind. I want only in aspx page. Is there any other way to set the imageurl?

        Regards n Thks Sam.M

        C 1 Reply Last reply
        0
        • S Sam M

          I dont want to assign this in code behind. I want only in aspx page. Is there any other way to set the imageurl?

          Regards n Thks Sam.M

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Not really, do you need to use the asp control and not the img tag ?

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          S 1 Reply Last reply
          0
          • C Christian Graus

            Not really, do you need to use the asp control and not the img tag ?

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            S Offline
            S Offline
            Sam M
            wrote on last edited by
            #5

            Sorry, I want only image button. Bcoz i'm using around 50 pages. I can't change all now..!! Any other solution is there? Please help..!!

            Regards n Thks Sam.M

            E C 2 Replies Last reply
            0
            • S Sam M

              Sorry, I want only image button. Bcoz i'm using around 50 pages. I can't change all now..!! Any other solution is there? Please help..!!

              Regards n Thks Sam.M

              E Offline
              E Offline
              eyeseetee
              wrote on last edited by
              #6

              Do you mean you want the same image to be applied to the image button throughout your project? If so just use a common_methods class and declare it in there

              C S 2 Replies Last reply
              0
              • S Sam M

                Sorry, I want only image button. Bcoz i'm using around 50 pages. I can't change all now..!! Any other solution is there? Please help..!!

                Regards n Thks Sam.M

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Quite plainly, if <%= is not parsed in the image tag, then I don't see what other solution you could possibly hope for, in the ASPX. I spent some time testing, and sure enough, for an Image server control, the values need to be set in the code behind, for an img tag, the inline method works fine.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                1 Reply Last reply
                0
                • E eyeseetee

                  Do you mean you want the same image to be applied to the image button throughout your project? If so just use a common_methods class and declare it in there

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  The problem is that the Image tag does not run the inline code tags.

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  1 Reply Last reply
                  0
                  • E eyeseetee

                    Do you mean you want the same image to be applied to the image button throughout your project? If so just use a common_methods class and declare it in there

                    S Offline
                    S Offline
                    Sam M
                    wrote on last edited by
                    #9

                    Same image path but different image name. how to get that value from common_methods? Also i don't want to use codebehind..!!

                    Regards n Thks Sam.M

                    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