-1

I have this code on my project. string="my string"

how i show this string on a button as a tool-tip. I want this to do programmatically. I want this to do in my code not the design.

i do my codings in asp.net with c# language

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jayarathne
  • 7
  • 1
  • 5

1 Answers1

1

Here's how to add the tooltip programmatically

just get the id of the button

<asp:Button id="button1" Text="Submit" runat="server" />

in your code behind:

//do some code to retrieve data from database and store it to this variable
String tooltip = "some text"; 

button1.ToolTip = tooltip;
Dyrandz Famador
  • 4,499
  • 5
  • 25
  • 40
  • I want to show the tooltip from my data which was get from a database.so i have data as strings on my code.so i need to show that strings on my tootltip.They are dynamicaly data.so can be changed.In my example i want to pass the "my string" to the tooltip but i want it without typing "my string".How can i do this? – Jayarathne Mar 09 '15 at 03:34
  • How sample showing WinForm control will help OP with WebForms??? – Alexei Levenkov Mar 09 '15 at 03:35