473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

simple question: How to refer to an image on the header control?

tom
Hi,

I am a newbie and have a simple question?
I have a aspx file and on the form I have a user control which is my
header and has some images. Now for various pages I need to load
different images on the header. How to replace image "A" with image "B"
on the control programatically?

I Use C# and Visual Studio 2005.

Any help is greatly appreciated,
Tom
Feb 26 '06 #1
1 1115
Hi,

you could have a property in the UC which is mapped to the ImageUrl (e.g if
you have a Image control in the user control) and this property could be set
by the Page. If you have Image with ID "Image1" in the user control, you
could have a property
public string ImageUrl
{
get
{
return Image1.ImageUrl;
}
set
{
Image1.ImageUrl = value;
}
}

And this then could be set by the Page with <UserControlID>.ImageUrl="url to
the img"; For example if you have it on Page

<uc1:WebUserControl1 ID="ucHeader" runat="server" />

then set in code

ucHeader.ImageUrl = "images/image.gif";

(you would need to have a member with UC's type in page's code-behind if you
use ASP.NET 1.1)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"tom" <as**@adsf.com> wrote in message
news:XQ*******************@news20.bellglobal.com.. .
Hi,

I am a newbie and have a simple question?
I have a aspx file and on the form I have a user control which is my
header and has some images. Now for various pages I need to load different
images on the header. How to replace image "A" with image "B" on the
control programatically?

I Use C# and Visual Studio 2005.

Any help is greatly appreciated,
Tom

Feb 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ken | last post by:
How does IE6 control the display of images? I change the content of a image file image1.jpg without changing the file name. Then jump to a new page to display it. IE6 does not displays the...
2
by: Nadav | last post by:
Hi, I am new to WebControls, I have created a WebControl that is used to present an image, the image bing presented is created on runtime, each client side button click causes the image to...
1
by: Morten Snedker | last post by:
I have a datagrid with multiple columns. Clicking one column header makes it sort. Clicking again makes a reverse sorting. But also I want to show the correct little image in the header,...
4
by: danu | last post by:
I'm trying to read data from a file (line by line) and trying to assign the values to the structure members. I'm kind of lost in this case since the books I'm using for reference doesn't give any...
5
by: Vear | last post by:
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have to use a <asp:hyperlink> to go to another page. I want to pick up the value in a text box. This is what I've tried and It...
1
by: Wayne | last post by:
I have an image control in a report's detail section that gets its image from an invisible bound textbox (PhotoFile) on the report. The following code is placed in the report's Detail_Format event....
2
by: Crimson* | last post by:
I've got a table with an entry type as "OLE Object" in Access 2003. In the form that the table is linked to I want to insert an image (BMP) for each record. However, when I attempt to do so the...
9
by: peashoe | last post by:
I need to create a javascript that not only changes a picture, but also the link: here is an example of what I need www.myweddingfavors.com/ I'm working on this website and have it half done:...
6
by: Jeff | last post by:
hi asp.net 2.0 I have a image (.jpeg) stored in sql server 2005 and now I want to display it on a webpage. So I created a webpage (Image.aspx) which just writes the buffer data to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.