...

View Full Version : Set an image source dynamically from a variable or QueryString



QuickFix
05-16-2007, 07:25 PM
Hi,

I have a simple request. How do I set the source of an image in an ASP page using a variable? Example:

<script runat="server">
protected void Page_Load(Object Source, EventArgs E)
{
String Image = "http://www.codingforums.com/img/logo.gif";
}
</script>

<asp:Image ID="Image1" runat="server" ImageUrl = (Image Variable) />

Any reply would be greatly appreciated!

QF

NuneatonSam
05-16-2007, 07:49 PM
You can set the ImageURL property in the Page_Load.

<script runat="server">

protected void Page_Load(Object Source, EventArgs E)
{
Image1.ImageURL = "http://www.codingforums.com/img/logo.gif";
}

</script>

<asp:Image ID="Image1" runat="server" />

Hope this helps.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum