D
data
I searched the internet and saw an old posting which has the same
problem I am experiencing. The asp server doesn't recognize the
variable I declare publicly in my codebehind class. The variable
works fine if I just display in the page "<%=myImageFileName%>", but
the server control doesn't recognize it. Is it a miscrosoft bug or
did I got the syntax wrong? I am stuck. Please help me. My imageurl
is dynamicly generated during page load. So I can't just hard-code it
in the page.
Thanks!
<asp:Image runat="server" ID="myImage" ImageUrl = "<%=myImageFileName
%>" />
This is the original posting and I got the exact same problem.
==========================================================
Pardon. This question seems incredibly dumb but I seem to
be suffering a brain block. I want an ASP.Net 2.0 image control
to contain a variable for the image file name as shown...
<asp:Image runat="server" ID="myImage" ImageUrl = "<%=myImageFileName
%>" />
The variable myImageFileName is set in either the Page_Init or
Page_Load
event handler. The markup appears on a master page which is used
used by .aspx pages in different folders, and at different levels of
indirection with respect to the project root.
Is it that the script is being rendered before Page_Init?
Doesn't sound right. In fact, if I write
<td><% = myImageFileName %></td>
the file name shows up on the rendered page as expected.
I believe the previous image tag works if the feature is a client-
side
HTML tag. That is,
<img src="<%=myImageFileName %>" alt="" />
will *probably* produce the desired result. However, I have used an
active control because the path name in the file name contains the
"~" character, representing the project root which of course
is meaningless in an HTML tag.
problem I am experiencing. The asp server doesn't recognize the
variable I declare publicly in my codebehind class. The variable
works fine if I just display in the page "<%=myImageFileName%>", but
the server control doesn't recognize it. Is it a miscrosoft bug or
did I got the syntax wrong? I am stuck. Please help me. My imageurl
is dynamicly generated during page load. So I can't just hard-code it
in the page.
Thanks!
<asp:Image runat="server" ID="myImage" ImageUrl = "<%=myImageFileName
%>" />
This is the original posting and I got the exact same problem.
==========================================================
Pardon. This question seems incredibly dumb but I seem to
be suffering a brain block. I want an ASP.Net 2.0 image control
to contain a variable for the image file name as shown...
<asp:Image runat="server" ID="myImage" ImageUrl = "<%=myImageFileName
%>" />
The variable myImageFileName is set in either the Page_Init or
Page_Load
event handler. The markup appears on a master page which is used
used by .aspx pages in different folders, and at different levels of
indirection with respect to the project root.
Is it that the script is being rendered before Page_Init?
Doesn't sound right. In fact, if I write
<td><% = myImageFileName %></td>
the file name shows up on the rendered page as expected.
I believe the previous image tag works if the feature is a client-
side
HTML tag. That is,
<img src="<%=myImageFileName %>" alt="" />
will *probably* produce the desired result. However, I have used an
active control because the path name in the file name contains the
"~" character, representing the project root which of course
is meaningless in an HTML tag.