Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Using the code behind to show an image (http://www.velocityreviews.com/forums/t726561-using-the-code-behind-to-show-an-image.html)

bthumber 06-25-2010 08:08 PM

Using the code behind to show an image
 
How do you made a reference to an image in the code behind? I'm trying to
show a high priority "!" image if an "h" was in the label. Please the code
below.

view plaincopy to clipboardprint?
private void ShowPriority()
{
StorePriority.Value = "n";
myLabel.Text = StorePriority.Value;
if(myLabel.Equal("n");
{
myLabel.Text = " ";
}
else
{
// How do reference the path to the image?
}

Sarath Babu S 07-08-2010 06:10 AM

Re: Using the code behind to show an image
 
You have to use an asp:Image control, with ImageUrl property set to the
priority icon file. You can then show and hide the image according to the
priority.


private void ShowPriority()
{
StorePriority.Value = "n";
myLabel.Text = StorePriority.Value;
yourImage.ImageUrl = "....";

if(myLabel.Equal("n");
{
myLabel.Text = " ";
yourImage.Visible = false;
}
else
{
yourImage.Visible = true;
}

Sarath Babu S
http://www.consultsarath.com



"bthumber" <bthumber@discussions.microsoft.com> wrote in message
news:C7F824BC-7D62-49E6-B7E1-953E4BAE1A71@microsoft.com...
> How do you made a reference to an image in the code behind? I'm trying to
> show a high priority "!" image if an "h" was in the label. Please the
> code
> below.
>
> view plaincopy to clipboardprint?
> private void ShowPriority()
> {
> StorePriority.Value = "n";
> myLabel.Text = StorePriority.Value;
> if(myLabel.Equal("n");
> {
> myLabel.Text = " ";
> }
> else
> {
> // How do reference the path to the image?
> }




All times are GMT. The time now is 05:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.