在imagebutton上显示动态文本 [英] display a dynamic text on imagebutton

查看:126
本文介绍了在imagebutton上显示动态文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在图像按钮上显示动态文本.
更具体地说,我在列表视图中有一个imagebutton列表,然后将鼠标悬停在该imagebutton上将显示相应的信息文本(例如来自变量).

有什么建议吗?
我搜索了网站,找不到合适的解决方案.
非常感谢.

I want to display a dynamic text on an imagebutton.
more specifically, I have a imagebutton list in a listview, then with mouseover, the corresponding information text (e.g. from a variable) will be displayed for this imagebutton.

Any suggestions?
I have searched website and could not find a suitable solution.
many thanks.

推荐答案

我正在提供需要jQuery和脚本编写工具的解决方案.在服务器端的listview数据绑定事件上,您可以像这样添加效果
I''m giving solution which requires jQuery and scripting stuff. On server side on data bound event of listview you can add effect like this
    protected void lvVendors_DataBound(object sender, EventArgs e)
    {
        foreach (var item in lvVendors.Items)
        {
            string cid=((LinkButton)item.FindControl("lnkbtnEdit")).ClientID;                    ScriptManager.RegisterClientScriptBlock(this,GetType(),item.ToString(),"


(''"+cid+"'').hover( function () { val=document.getElementById(''"+cid+"'').innerText; document.getElementById("abc").innerText="my new text"; }, function () { document.getElementById(''"+cid+"'').innerText=val; } ); ",true); } }
(''"+cid+"'').hover( function () { val=document.getElementById(''"+cid+"'').innerText; document.getElementById("abc").innerText="my new text"; }, function () { document.getElementById(''"+cid+"'').innerText=val; } ); ",true); } }



我使用链接按钮而不是图像按钮,可以轻松更改它.而且,您需要添加脚本以将jQuery加载到页面上.



I had used link button instead of image button you can change it easily. And you need to add script to load jQuery on your page


我提供的解决方案需要jQuery和脚本编写内容.在服务器端的listview数据绑定事件上,您可以像这样添加效果
I''m giving solution which requires jQuery and scripting stuff. On server side on data bound event of listview you can add effect like this
    protected void lvVendors_DataBound(object sender, EventArgs e)
    {
        foreach (var item in lvVendors.Items)
        {
            string cid=((LinkButton)item.FindControl("lnkbtnEdit")).ClientID;                    ScriptManager.RegisterClientScriptBlock(this,GetType(),item.ToString(),"


这篇关于在imagebutton上显示动态文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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