HighTechTalks DotNet Forums  

Using the code behind to show an image

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Using the code behind to show an image in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
bthumber
 
Posts: n/a

Default Using the code behind to show an image - 06-25-2010 , 03:08 PM






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?
}

Reply With Quote
  #2  
Old   
Sarath Babu S
 
Posts: n/a

Default Re: Using the code behind to show an image - 07-08-2010 , 01:10 AM






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 (AT) discussions (DOT) microsoft.com> wrote

Quote:
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?
}

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.