VR,
Either use a asp.net image control. Which will have the runat="server" tag
and means that it will be declared in the codebehind, or convert your html
image tab into a server control by adding the runat="server" tag to it.
The first way is probably easier (because the object's declaration will be
added to the code-behind page automatically). Just drop an "Image" from the
web form toolbox onto your page and you'll get code like this in the html.
Also in your code-behind page you'll have a new object declared: "Image1".
<asp:Image id="Image1" runat="server"> </asp:Image>
The code-behind page's object declaration will look like:
Protected WithEvents Image1 As System.Web.UI.W ebControls.Imag e
Now, simply use the same code you gave as an example setting the image
object's source.
Image1.ImageUrl = "/graphics/TopSignOff.gif" ;
You're other option is similar.
Add the runat="server" attribute to your image tag.
Give your image tag an id.
<img id="Image1" runat="server">
Declare a matching object on the code behind page.
Protected Image1 As System.Web.UI.H tmlControls.Htm lImage
Now set the source:
Image1.Attribut es.Add("src", "/graphics/TopSignOn.gif")
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"VR" <an*******@disc ussions.microso ft.com> wrote in message
news:03******** *************** *****@phx.gbl.. .
Hi.
I have an ASP.NET web page, with a logo written in plain
HTML. One of the tags is an image that should read
either "sign on" or "sign off" depending on whether a user
has been authenticated:
<a href="javascrip t:void(FollowLi nk('SignOn'));" >
<IMG src="/graphics/TopSignOn.gif" name="TopSignOn ">
</a>
I'd like to determine which image to show in my Page_Load
() in ASP.NET. Something like:
void Page_Load()
{
if (Request.IsAuth enticated)
{
obj.src = "/graphics/TopSignOff.gif" ;
}
else
{
obj.src = "/graphics/TopSignOn.gif";
}
}
I am not sure, though, how to declare and/or find that
obj. Is it possible? Or should I choose a different
approach?
Thanks for the help.
VR