Click here to Skip to main content
15,919,341 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
In the if statement, if the value is true i have to display one image.else i have to display another image.

My code:
C#
function IsActveDisplay(status) {
        if (status == "1")

            return "success";
        else
            return "Failed";
    }

now it is returning success and failed depending up on the condition.inplace of that i want two different images.
Posted

Take two image buttons and give the image url's to those image buttons and write the code in page load as


C#
imagebutton1.visible=false;
imagebutton2.visible=false;


And in If condition you should write the code as

C#
if(status==1)
  imagebutton1.visible=true;
else if
  imagebutton2.visible=true;
 
Share this answer
 
v2
first You can hide both image visibility false in your aspx codeand during if condition true, you can visible your image.
C#
function IsActveDisplay(status) {
        if (status == "1")
{
 image1.visible=true;
            
}
        else
{
 image2.visible=true;
           
}
    }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900