Re: Images on server.
- From: "rcoco" <nclauder@xxxxxxxx>
- Date: 13 Apr 2007 00:30:33 -0700
On Apr 13, 9:01 am, "rcoco" <nclau...@xxxxxxxx> wrote:
On Apr 12, 5:33 pm, "Alexey Smirnov" <alexey.smir...@xxxxxxxxx> wrote:
On Apr 12, 11:20 am, "rcoco" <nclau...@xxxxxxxx> wrote:
Thanks Alexey for the help and for the patience.
The code
Image URL is: <%# "/Images/" +
((string)DataBinder.Eval(Container.DataItem, "MoodToday") == "Bad
Mood" ? "sad" : "laughing") + ".gif" %>
I get the error Specified cast is not valid at run time.
And when I changed the code to
<asp:Image id=Image1 runat="server" ImageUrl='<
%#DataBinder.Eval(Container.DataItem,"MoodToday")=="Bad
Mood"?"sad":"laughing" )+".gif"%>' Visible="True">
</asp:Image>
Only the Image laughing .gif appears whether Good Mood or Bad Mood is
selected.
Why is it so?
Have you tried to debug it?
Put this line as I already told you
Current Mood in the database is: ***<%#
DataBinder.Eval(Container.DataItem, "MoodToday") %>***
If you believe that a "Bad Mood" is selected (it has to be saved(!))
then you will see
***Bad Mood***
Otherwise you will see
***Good Mood***
***abracadabra***
******
and so on- Hide quoted text -
- Show quoted text -
Thanks Alexey,
It has worked properly. I had to select Bad Mood By default like you
had advised me.
I Really Want to thank you so so much it has worked so well. Thank you
especially for yo patience it's unusial.
Thanks again and to the rest who helped me in giving me a clou.- Hide quoted text -
- Show quoted text -
Sorry again Every thing was going on well but all of a sudden I got a
wired reaction:
Why is it that when I insert data I fast get an error :
Specified cast is not valid.
But When I run the site for the second time I find the data was saved
the right image was selected! Actually I can say every thing works
well apart that when ever I attempt to insert data this error appears:
Specified cast is not valid. on line:
<asp:Image id=Image1 runat="server" ImageUrl='<%#"/Images/"+
((string)DataBinder.Eval(Container.DataItem,"MoodToday")=="Bad
Mood"?"sad":"laughing") +".gif"%>' ImageAlign="Middle">.
Thanks
.
- Follow-Ups:
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- References:
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- From: Alexey Smirnov
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- From: Mark Rae
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- From: Larry Bud
- Re: Images on server.
- From: Mark Rae
- Re: Images on server.
- From: Alexey Smirnov
- Re: Images on server.
- From: Mark Rae
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- From: Alexey Smirnov
- Re: Images on server.
- From: rcoco
- Re: Images on server.
- Prev by Date: XHTMLconformance
- Next by Date: Re: Constants and thread safety
- Previous by thread: Re: Images on server.
- Next by thread: Re: Images on server.
- Index(es):