Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: how to change an image url at runtime

Thread Tools

Re: how to change an image url at runtime

Mark Kamoski
Posts: n/a


....still cannot figure this out...

....any help is appreciated...

"Mark Kamoski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...


Is there another way to do this without using Response.Write?

Why doesn't something like this work?

This code is in the code-behind for the user control for the Nav, which
SHOULD swap the a top banner image.

Why doesn't it work?

What do you think?

(Note-- I don't see where a Response.Write will help in this case.

(I suspect this has something to do with postback, the event cycle of the
host page, the event cycle of the user control, or something related to
these-- but, I don't know exactly where.)

//This is an image button event handler that exists in the user control.
//The image button exists on the user control.
private void ShowFeedback_Click(object sender,
System.Web.UI.ImageClickEventArgs e)

//This is the helper method that exists in the user control.
private void ShowBanner(string NavValue)
TopBanner.ImageUrl = "Images/BannerTop" + NavValue + ".gif";

"Jon Davis" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...

Response.Write("<script>TopBanner.src =


"Mark Kamoski" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> How can one change an image url at runtime?
> (Note, the image exists in a user control.)
> This is the image tag on the ascx...
> <asp:image id="TopBanner" runat="server"></asp:image>
> ...but I cannot get this to change from the code behind of a page that
> hosts the user control.
> Any ideas?
> Thanks.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
change web service URL at runtime ASP .Net Web Services 1 07-07-2006 06:13 AM
Change url of web service at runtime Gujju ASP .Net Web Services 2 05-31-2005 02:18 AM
Change URL of Web service at Runtime Gujju ASP .Net Web Services 0 05-30-2005 01:13 AM
changing ImageButton image url at runtime ASP .Net 1 01-27-2005 03:55 PM
How to change the URL of a web reference at runtime? ISGADMIN ASP .Net Web Services 2 11-02-2004 05:15 PM