Click here to Skip to main content
16,020,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi , I have a html control like
XML
<input id="Button1" type="button" value="button" />
      <input id="Text1" type="text" />
      <img alt="" src="" id="img1"  />


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
Posted

You need to add a
runat="server"

attribute to each of your HTML controls, and then you can use
HTML
Button1.Attributes.Add("title", "I am a button")

etc in yhour code behind
 
Share this answer
 
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.
 
Share this answer
 
Comments
ErBhati 11-Aug-14 8:51am    
It is same code as in Question.How you say it works.
ihiren Parmar 11-Aug-14 8:56am    
They write wrong spell of title.
This may one of the reasons it's not working for them.
Otherwise its correct code.

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