Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set an image source dynamically from a variable or QueryString 1

Status
Not open for further replies.

Quickfix99

Technical User
May 16, 2007
27
CA
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 = "}
</script>

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

Any reply would be greatly appreciated!

QF
 
You're welcome. Glad to help, even if it was a small part. :)
Brett
 
<img id = "Image1" runat ="server" />

Shouldn't this be:

<asp:image runat="server" id="Image1" />
It doesn't have to be. You can add a runat="server" tag to any HTML control to get access it from your code behind.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top