图片按钮代码 [英] Code for image button

查看:86
本文介绍了图片按钮代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在创建一个图像按钮,该按钮基本上用于设备的开/关功能.我的意思是说有一个灯泡的图像也是一个按钮.我需要此功能的代码.以及我如何每次都向数据库更新图像按钮的功能.

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.

推荐答案

为什么你不只是用谷歌搜索图像按钮ASP.NET :它将立即为您带来此链接: ASP.NET ImageButton [
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


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

}


这篇关于图片按钮代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆