PrabodaMP
PrabodaMP

Reputation: 3

ToolTip for Table cell ASP.NET

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

Upvotes: 0

Views: 2043

Answers (1)

PSK
PSK

Reputation: 17943

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>"));

Upvotes: 2

Related Questions