Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using the code behind to show an image

Reply
Thread Tools

Using the code behind to show an image

 
 
bthumber
Guest
Posts: n/a
 
      06-25-2010
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
 
 
 
 
Sarath Babu S
Guest
Posts: n/a
 
      07-08-2010
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" <> wrote in message
news:C7F824BC-7D62-49E6-B7E1-...
> 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

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
Non-code behind to code behind John ASP .Net 2 02-19-2007 07:08 PM
what is the difference between code inside a <script> tag and code in the code-behind file? keithb ASP .Net 1 03-29-2006 01:00 AM
Code-Behind Pain in the Behind! Daniel Manes ASP .Net 11 06-10-2005 09:47 PM
Fire Code behind code AND Javascript code associated to a Button Click Event =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?= ASP .Net 4 02-11-2004 07:31 AM
Re: Code Behind vs. no code behind: error Ben Miller [msft] ASP .Net 1 06-28-2003 01:46 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57