如何在asp.net的代码隐藏中将工具提示设置为htmlcontrol [英] how to set tooltip to htmlcontrol in codebehind in asp.net
本文介绍了如何在asp.net的代码隐藏中将工具提示设置为htmlcontrol的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个html控件,比如
Hi , I have a html control like
<input id="Button1" type="button" value="button" />
<input id="Text1" type="text" />
<img alt="" src="" id="img1" />
i希望在代码隐藏中设置其工具提示或小小。
我尝试了下面的代码,但它没有工作
i want to set its tooltip or tittle in codebehind .
I tried the following code but its not working
Button1.Attributes["tittle"] = "i am button";
Text1.Attributes["tittle"] = "i am text";
img1.Attributes["tittle"] = "i am image";
请帮助
Please help
推荐答案
您需要添加a
You need to add a
runat="server"
每个HTML控件的
属性,然后你可以使用
attribute to each of your HTML controls, and then you can use
Button1.Attributes.Add("title", "I am a button")
等yhour代码隐藏
etc in yhour code behind
你好,
使用此代码
Button1.Attributes [" title" ;] ="我是按钮" ;;
Text1.Attributes [" title"] =" i is text";
img1.Attributes [" title" ;] =我是形象;
它可能适合你。
hello,
Use this code
Button1.Attributes["title"] = "i am button";
Text1.Attributes["title"] = "i am text";
img1.Attributes["title"] = "i am image";
It may work for you.
这篇关于如何在asp.net的代码隐藏中将工具提示设置为htmlcontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文