473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need an Expert Oppinion..

I have troubles with a technique I used to take my images from specific folder to show them by using ImageButton webcontrol
It is still working properly offline, but when I uploaded my website, it didn't work, everything is going well and there is no errors, it's loading the ImageButtons with names but it doesn't show the image itself, what could be the possibilities..

If you require, I would send you the code, but please I need a prompt reply, it's urgent
Apr 9 '07 #1
14 1379
Motoma
3,237 Expert 2GB
I have troubles with a technique I used to take my images from specific folder to show them by using ImageButton webcontrol
It is still working properly offline, but when I uploaded my website, it didn't work, everything is going well and there is no errors, it's loading the ImageButtons with names but it doesn't show the image itself, what could be the possibilities..

If you require, I would send you the code, but please I need a prompt reply, it's urgent
Is the image location correct? Take a look at the generated HTML and see if it points to the correct location. Then check to make sure the image is there.
Apr 9 '07 #2
gomzi
304 100+
I have troubles with a technique I used to take my images from specific folder to show them by using ImageButton webcontrol
It is still working properly offline, but when I uploaded my website, it didn't work, everything is going well and there is no errors, it's loading the ImageButtons with names but it doesn't show the image itself, what could be the possibilities..

If you require, I would send you the code, but please I need a prompt reply, it's urgent
posting your code will be helpful in determining the error.
Apr 9 '07 #3
posting your code will be helpful in determining the error.
You could make sure that the location of the images is correct because when you hoover over the images' button it gives you the name of the image which is taken by "code genereation of" the image itself

here is the code:

public void Page_Load(object sender, EventArgs e)
{

int i = 0;

// get the address of the directory, then seach for files with .JPG extension inside
string add = Server.MapPath("pics\\gallery\\");
string[] images = Directory.GetFiles(add , "*.jpg");

// Create ImageButton Array, and use it to store & present result images in determine specifications
ImageButton[] imageBtt = new ImageButton[images.Length];
foreach (string image in images)
{
// Add special character \\ to the address to add it to .ImageURL - e.g. \" adds "

imageBtt[i] = new ImageButton();
imageBtt[i].Width = 70;
imageBtt[i].Height = 47;
imageBtt[i].ID = Path.GetFileNameWithoutExtension(image);
imageBtt[i].Visible = true;
imageBtt[i].ToolTip = Path.GetFileNameWithoutExtension(image);
imageBtt[i].ImageUrl = "\\\\" + image;
imageBtt[i].Click += new System.Web.UI.ImageClickEventHandler(ImageButton_C lick);

ContentPlaceHolder3.Controls.Add(imageBtt[i]);
i++;
}


and you could browse through the website to test the results:
http://www.qebab.com/Galleries.aspx
Apr 11 '07 #4
nmsreddi
366 256MB
Hello

you said its working fine in offline you mean its working in your system where actually you developed that website ,if so is the case first see the path of the images you are using ,they may be refered to your local drive path,replace that path by ..//image.img(your image) nothing but the default path for your image
try with this ,it maywork fine

Good Luck
Apr 11 '07 #5
Motoma
3,237 Expert 2GB
Eyadtrabulsi, take a look at the generated HTML and see if the image path is correct.
Apr 11 '07 #6
When I save it in .htm file, I checked the SRC of the image it looks empty as below:

type=image src="" name=ctl00$ContentPlaceHolder3$bath-m><INPUT
id=ctl00_ContentPlaceHolder3_bath-m1 title=bath-m1
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 70px; HEIGHT: 47px; BORDER-RIGHT-WIDTH: 0px"

but what I'm thinking of that as it's showing in the C# code above, I made it like automatically it searchs for the images in specific directory which is "gallery" here then it takes all the informations from the image's file itself, and as you noticed "for instance" the tooltip reflects the name of the image so I don't think there is something wrong with the path, because it would not give me the right information if it didn't reach the image's file
Could it be by the format Server.MapPath returns to ImageURL, but why did it work offline??!!
Apr 11 '07 #7
Motoma
3,237 Expert 2GB
I am not sure why it worked offline...try taking a look at the source for the offline version. Compare the two; see if you can find a difference. Regardless, this is the source of your problem.

Perhaps you should go back the the C# code and see if it is using the correct paths for gathering your gallery. What may be happening is that the production paths are different than the development paths, therefor debugging it on the server will work, but rolling the code out breaks it.
Apr 11 '07 #8
I saved the .htm file by the offline version and checked out the code, it's the same but with SRC:

type=image src="Qebab Gallery_files/bath-m.jpg"
name=ctl00$ContentPlaceHolder3$bath-m><INPUT
id=ctl00_ContentPlaceHolder3_bath-m1 title=bath-m1
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 70px; HEIGHT: 47px; BORDER-RIGHT-WIDTH: 0px"

but when you notice that all the other information are the same, and with using Server.MapPath("pics\\gallery\\");
with both.. which discover the path on the server it works on, beside that when you click on any of the images "online or offline" you see the reflected path on the new generated page's URL "which I send to get the same URL for the image to have it in bigger size when clicking" and which is correct URL
With everything I mentioned I feel that the error is in showing the image not in the image's path, What do you think??
Apr 12 '07 #9
Motoma
3,237 Expert 2GB
The offline version has the SRC piece filled, and the online version does not. This is the source of your problem.
Apr 12 '07 #10
Is there anyway to solve it..?? or is there any logical reason ??

I realy need an expert's oppinion...
Apr 12 '07 #11
Motoma
3,237 Expert 2GB
Is there anyway to solve it..?? or is there any logical reason ??

I realy need an expert's oppinion...
Is there a pics\\gallery\\ folder in your web server's directory.
I can't help you out anymore than this. You are the only one who knows what your file structure looks like, and what your code looks like.
Apr 12 '07 #12
Nikky
25
1.save ur form and the image in the same directory. and check its path in html coading.

2.Or try ImageUrl="~/myImage.jpg"
It will directly take dynamic path
Apr 13 '07 #13
Of corse I have \\pics\\gallery directory and I have all my images inside
The root directory is called qebab I have all my directories inside so you could find pics and then gallery inside..

As for using ~/myimage.jpg I can not because my code detects the files itself inside "gallery" then it represents them, so I don't already know the file's name

I tried to use the virtual path as follows
string path = "~/pics/gallery/";
but it gave me this error

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\windows\system32\inetsrv\~\pics\gallery'
Apr 14 '07 #14
Now I fixed it up

I kept Server.MapPath"\\pics\\gallery\\" like it is, but i changed the ImageURL as follows:

imageBtt[i].ImageUrl = "~/pics/gallery/" + Path.GetFileNameWithoutExtension(image) + ".jpg";

Elhamdullah it's going well now

Thank you all for trying to help me ;-)
Apr 14 '07 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Nikolay Bogolioubov | last post by:
Anybody knows where can I get a good "intermediate to expert" level C++ questions list. Need about 500 questions. Appreciate any ideas.
31
by: mark | last post by:
Hello- i am trying to make the function addbitwise more efficient. the code below takes an array of binary numbers (of size 5) and performs bitwise addition. it looks ugly and it is not elegant...
1
by: Migrators | last post by:
I want to become an expert in C programming. Where can I find free electronic versions (.pdf or .doc) of C materials so that I can download it and study. Please specify the links.
0
by: KRUNOPOPOVIC | last post by:
Hi, I made new screen saver ElasticField in (unmanaged c++/directx)/c#. Please try it: http://www.geocities.com/krunopopovic/ and tell me your oppinion.
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
0
by: onegative | last post by:
G'day Y'all, I was hoping to get some expert feedback on a proposal I am considering regarding a new internal application to help fill some gaps in our IT department. I have some configuration...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.