Images on server.

R

rcoco

Cool! Now we're getting somewhere - you're finally using relative
addressing - hurrah!

So, is the above source actually correct relative to the folder that the
ASPX is in...?

Yes it is.
 
R

rcoco

Yes it is.- Hide quoted text -

- Show quoted text -

Hi,
I was wondering does it matter where I place the folder with the
Images could it be the problem?
Thanks.
 
M

Mark Rae

They are next to the Bin folder hope I'm not doing a mistake!

Oh dear... The important thing here is the depth of the folder in relation
to the root.

Once again...

Imagine your site has the following structure (FORGET TOTALLY ABOUT
C:\Inetpub\wwwroot !!!)

<root>
\bin
\Properties
\References
\Folder1
File1.aspx
File2.aspx
\Folder2
File3.aspx
File4.aspx
\Folder3
File5.aspx
\images
logo.jpg
\master
default.master
default.aspx
Global.asax
web.config

You are editing \Folder1\File1.aspx and want to include a link to your
logo - do this: ImageUrl="../images/logo.jpg"

However, that wouldn't work for File5.aspx because it is at a different
depth relative to the root. For File5.aspx, you'd need to do:
ImageUrl="../../images/logo.jpg"
 
G

Guest

You are editing \Folder1\File1.aspx and want to include a link to your
logo - do this: ImageUrl="../images/logo.jpg"

However, that wouldn't work for File5.aspx because it is at a different
depth relative to the root. For File5.aspx, you'd need to do:
ImageUrl="../../images/logo.jpg"

Parent paths are disabled by default in IIS 6.0 and can be disabled on
IIS 5 as well.

Why don't you use

ImageUrl="/images/logo.jpg"

That path will always work, with no depends where the aspx is located.
 
R

rcoco

On localhost, the code: ImageUrl="/images/logo.jpg" works but when
deployed on server it doesnot work? Why is it so?
Thanks.
 
G

Guest

On localhost, the code: ImageUrl="/images/logo.jpg" works but when
deployed on server it doesnot work? Why is it so?
Thanks.

On the server you should have the same configuration as on the
localhost. Namely,

1) the aspx page is in the root directory
2) the root directory has /images
3) logo.JPG is in the /images
 
R

rcoco

Thanks alot,
I have just realised my stupid mistake, I wasn't deploying the Image
after deploying the image i had to only add this code in html:
ImageUrl="logo.JPG" and now it's working well.
Thanks again.
 
M

Mark Rae

I have just realised my stupid mistake, I wasn't deploying the Image

That was the very first thing I asked you in my first reply to your original
post back on 30th March...
 
R

rcoco

Yes I have realised that's true that's why it becomes more stupid of
me not to have realised that yet I had the answer from you at the
begining. Sorry for that and I really Appriciate all the help.
Thanks alot
 
R

rcoco

Here again I'm in trouble. I have this datagrid column that is
Supposed to hold both Character and Image. I set RadioButtonlist that
has two radiobutton. One good mood the other one bad mood. In the same
column are two images one imggm the other imgbm. When radiobutton good
mood is selected I want image imggm to be selected automatically. I'm
using this code.

System.Web.UI.WebControls.RadioButtonList st5=new
System.Web.UI.WebControls.RadioButtonList();
st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl("rblmood");
System.Web.UI.WebControls.Image imgDaily=new
System.Web.UI.WebControls.Image();
imgDaily=(System.Web.UI.WebControls.Image)e.Item.Cells[1].FindControl("imgbm");
myCommand.Parameters.Add(new SqlParameter("@MoodToday",SqlDbType.Char,
45));
if(e.Item.Cells[1].Equals("Bad Mood"))
{
imgDaily.ImageUrl = "imgbm";
}
else
{
imgDaily.ImageUrl = "imggm";
}
myCommand.Parameters["@MoodToday"].Value=st5.SelectedValue;
My problem is that only goog mood appears but the image imggm does not
does not appear how should I do it.
Thanks
 
G

Guest

Here again I'm in trouble. I have this datagrid column that is
Supposed to hold both Character and Image. I set RadioButtonlist that
has two radiobutton. One good mood the other one bad mood. In the same
column are two images one imggm the other imgbm. When radiobutton good
mood is selected I want image imggm to be selected automatically. I'm
using this code.

System.Web.UI.WebControls.RadioButtonList st5=new
System.Web.UI.WebControls.RadioButtonList();
st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl(­"rblmood");
System.Web.UI.WebControls.Image imgDaily=new
System.Web.UI.WebControls.Image();
imgDaily=(System.Web.UI.WebControls.Image)e.Item.Cells[1].FindControl("imgb­m");
myCommand.Parameters.Add(new SqlParameter("@MoodToday",SqlDbType.Char,
45));
if(e.Item.Cells[1].Equals("Bad Mood"))
{
imgDaily.ImageUrl = "imgbm";}

else
{
imgDaily.ImageUrl = "imggm";}

myCommand.Parameters["@MoodToday"].Value=st5.SelectedValue;
My problem is that only goog mood appears but the image imggm does not
does not appear how should I do it.
Thanks
From the code above you cannot see if e.Item.Cells[1] equals the "Bad
Mood" or not. I'm also confused about

e.Item.Cells[1].FindControl("imgb­m");

It used the same cell of the grid. If cell[1] contains a control named
"imgb­m", it cannot be equal to the "Bad Mood"
 
R

rcoco

Imgbm is a sad img is supposed to equal Bad Mood. And these are two
different images. it's supposed to be small image followed by the word
bad or good mood now e.Item.Cells[1].FindControl("imgb­m"); I'm not
sure about it at all. But hope you've managed to get what I want to
do? If you could help me Please.
Thanks
 
G

Guest

Imgbm is a sad img is supposed to equal Bad Mood. And these are two
different images. it's supposed to be small image followed by the word
bad or good mood now e.Item.Cells[1].FindControl("imgb­m"); I'm not
sure about it at all. But hope you've managed to get what I want to
do? If you could help me Please.
Thanks

"Imgbm" cannot be a name of an image and you cannot use it as a value
for the ImageUrl property.

e.Item.Cells[1] cannot be equals to "Bad Mood". If "Bad Mood" is a
value of a radiobutton, then you should compare the value of the
radiobutton

if(st5.SelectedValue == "Bad Mood") {
....
} else {
....
}

Start the application in Debug Mode and check the values.
 
R

rcoco

Hi,
have just tryed this but it seems not to work? where is it wrong?
if(st5.SelectedValue=="Bad Mood")
{
st5.SelectedValue="Images/sad.gif";
}
else if(st5.SelectedValue=="Good Mood")
{
st5.SelectedValue="Images/laughing.gif";
}
And this is the error I'm getting:
Specified argument was out of the range of valid values. Parameter
name: Images/laughing.gif.
Thanks
 
G

Guest

Hi,
have just tryed this but it seems not to work? where is it wrong?
if(st5.SelectedValue=="Bad Mood")
{
st5.SelectedValue="Images/sad.gif";}

else if(st5.SelectedValue=="Good Mood")
{
st5.SelectedValue="Images/laughing.gif";}

And this is the error I'm getting:
Specified argument was out of the range of valid values. Parameter
name: Images/laughing.gif.
Thanks

st5 is your RadioButtonList

st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl(­"rblmood");

so, what do you want to get using

st5.SelectedValue="Images/laughing.gif";

?
 
R

rcoco

Hi,
have just tryed this but it seems not to work? where is it wrong?
if(st5.SelectedValue=="Bad Mood")
{
st5.SelectedValue="Images/sad.gif";}
else if(st5.SelectedValue=="Good Mood")
{
st5.SelectedValue="Images/laughing.gif";}
And this is the error I'm getting:
Specified argument was out of the range of valid values. Parameter
name: Images/laughing.gif.
Thanks

st5 is your RadioButtonList

st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl(­­"rblmood");

so, what do you want to get using

st5.SelectedValue="Images/laughing.gif";

?

Sorry I've been away for some time. Yes st5 is my RadioButtonList. I
want the image laughing to come along when good mood is selected.
that's: st5.SelectedValue="Images/laughing.gif";
Thanks.
 
G

Guest

st5 is your RadioButtonList
st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl(­­­"rblmood");

so, what do you want to get using
st5.SelectedValue="Images/laughing.gif";

?

Sorry I've been away for some time. Yes st5 is my RadioButtonList. I
want the image laughing to come along when good mood is selected.
that's: st5.SelectedValue="Images/laughing.gif";
Thanks.- Hide quoted text -

- Show quoted text -

1) SelectedValue is a read-only property and you cannot assign a value
using st5.SelectedValue=...

2) st5 is a RadioButtonList and it cannot be equal to the "Images/
laughing.gif"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top