setting an image path to an image button from c# CODE PLEASE HELP - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

setting an image path to an image button from c# CODE PLEASE HELP

saja123saja123 Posts: 1Member
hi im using for my web project and using c# my programming lang
the problem is
i have an image button on my web page. i have images saved on the server in a directory called Images. if i wanna change the image , i read the new image path from a datase and assign it to the image url.
but i am having a problem!

when ever i set the image path from the properties window
of the image button then it reads the correct directory on the server and
displays the image

but when i give the path from the c# code it doesnt show any image!
its like its not listening to the c# code when i do it through the code
coz when it runs on the server and if i give the path from the c# code i viewed the source of the page (the html code from ie browser) and it
shows nothing as the image url

in my code i have given the url like this:

ImageButton12.ImageUrl = "./Images/kiosk.jpg";

i tried this piece of code everywhere even in pageload method.

here how it looks like in the html code when it runs on the server

as u can see from the htmml code that has been generated , it never
assigns an image path .

but when i give the image url through image button's properties window (if i do like thiss i cant change the image at runtime)
then the image appears on the webpage and here how the html code of the
page looks like

now the image appears on the the web page

how come it never assigns a path to the image when it was given through
the c# code

please help me anyone i just dont unserstand what the hell is happening

saj :((


Sign In or Register to comment.