How to manipulate an image on the user control?

T

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
 
A

Aboulfazl Hadi

Hi
Define a property in the userControl that manipulate the Image. then in
the form's load event of the form write code to change image depend on
forms.

Write the following code in the UserControl( I assume that you use an
image control in the WebUseControl)

public string URL
{
get
{
return Image1.ImageUrl;
}
set
{
Image1.ImageUrl = value;
}
}

then write the following in the form load :
WebUserControl1.URL = "test.gif";

Best Regards,
A.Hadi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top