| |

VerySource

 Forgot password?
 Register
Search
View: 625|Reply: 3

How to realize that when the mouse is moved to a certain row in the DataGrid, a ToolTip pops up to display all the field

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 South Africa

Post time: 2020-2-13 14:30:01
| Show all posts |Read mode
How to realize that when the mouse is moved to a certain row in the DataGrid, a ToolTip pops up to display all the fields of that row?
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-16 10:00:02
| Show all posts
<a title="Floating text displayed"> <% # DataBinder.Eval (Container.DataItem, "Data Field")%> </a>
Reply

Use magic Report

0

Threads

22

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-6-7 16:15:01
| Show all posts
Study this, this is what I copied in a program (I have not used it, but the effect is what you want), it should be helpful to you.

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
//
// Used to display relevant test data
//
if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.SelectedItem)
{
string _strDiv = "javascript:showmenu(event,\"<Font size=9px><Table cellSpacing=0 cellPadding=1 width=100% border=1 border=0><tr style=BORDER-BOTTOM: #808080 1px solid> ";
for (int i = 1 ;i <e.Item.Cells.Count-2;i++)
{
if (DataGrid1.Columns[i].Visible != false)
{
_strDiv +="<td width=100px class=TD1>";
_strDiv += DataGrid1.Columns[i].HeaderText.ToString()+"&nbsp</td>";
_strDiv += "<td width=40px class=TD1>" + e.Item.Cells[i].Text + "&nbsp</td>";
if ((i% 3) == 0&&i != 0&&i != e.Item.Cells.Count-2)
{
_strDiv += "</tr><tr>";
}
else
{
if (i == e.Item.Cells.Count-2) // how is the last item
{
if ((i% 3) == 0) //
{
_strDiv += "</tr>";
}
else
{
for (int ii = 1 ;ii<=3-(i%3);ii++)
{
_strDiv +="<td class=TD1>&nbsp</td><td class=TD1>&nbsp</td>";
}
_strDiv += "</tr>";
}
}
}
}
}
_strDiv += "</table></Font>\")";
e.Item.Attributes.Add("onmouseover",_strDiv);
}
}
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

 Author| Post time: 2020-7-24 15:45:01
| Show all posts
nailed it,
I did
ToolTip='<%# "Name: "+DataBinder.Eval(Container.DataItem,"StudentName")+"\n gender: "+DataBinder.Eval(Container.DataItem,"Sex")+ "\n class: "+ DataBinder.Eval(Container.DataItem,"Class")+ "\n birthday: "+DataBinder.Eval(Container.DataItem,"BirthDate") %>' ID="name" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"StudentNum") %>'

Thank you all
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list