Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i assign the tooltip of a selected item to a string during runtime
Posted
Comments
DamithSL 1-Jun-15 0:47am    
what is the control you are using?
Member 11521909 1-Jun-15 0:55am    
image

First, add a ToolTip control to your form and call it "ttMain".
Then just call the SetToolTip method, passing it the string and the control you want to display it for:
C#
string tip = string.Format("Save the file \"{0}\" to disk", fileName);
ttMain.SetToolTip(buttonSave, tip);
 
Share this answer
 
please check the code for aspx page below :-
C#
 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:image id="Image1" runat="server" tooltip="This is image tooltip"   />
    </div>
    </form>
</body>
</html>

and the code behind page look like as below :-
C#
protected void Page_Load(object sender, EventArgs e)
    {
        string str = Image1.ToolTip;

        Response.Write(str);
    }


It as straight as assigning any text to string at runtime.
 
Share this answer
 
v2

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