ToolTip for Table cell ASP.NET Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of ToolTip for Table cell ASP.NET without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have created a dynamic table using below code.It is only a part of my code.

if (i >= startNo && i <= endNo) {
        panelName.Controls.Add(new LiteralControl("<td style=background-color:lightblue; >&nbsp;</td>"));
} else {

        panelName.Controls.Add(new LiteralControl("<td>&nbsp;</td>"));
}

I need to show a popup/tooltip message if the color is lightblue. Could you please help me out to figure this out?

Output of the current program

Answer

You can use the title property of the td like folloiwng.

panelName.Controls.Add(
new LiteralControl("<td title='some title' style=background-color:lightblue; >&nbsp;</td>"));

To set some dynamic value from server, you can try like following.

  string someToolTip = "Got from DB";
  panelName.Controls.Add(
 new LiteralControl("<td title='" someToolTip  + "' " +  "style=background-color:lightblue; >&nbsp;</td>"));
We are here to answer your question about ToolTip for Table cell ASP.NET - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji