Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am creating an image button which basically does the on/off functions for a device.I mean to say there is a image of a bulb which is also a button. I need a code for this functionality. And also how do i update the functionalities of the image button each time to the database.
Posted

Why didn't you just google this "Image button ASP.NET": It would have brought you this here link immediately: ASP.NET ImageButton[^].

Regards,

Manfred
 
Share this answer
 
v2
C#
static int flag = 0;
protected void Page_Init(object sender,EventArgs e)
{
    ImageButton.ImageUrl = "BlubOff.jpg";
}
protected void ImageButton_Click(object sender,EventArgs e)
{
    if(flag == 0)
    {
        ImageButton.ImageUrl = "BlubOn.jpg";
        flag = 1;
    }
    else if(flag == 1)
    {
        ImageButton.ImageUrl = "BlubOff.jpg";
        flag = 0;
    }

}
 
Share this answer
 
v3

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