在gridview单元格鼠标上工具提示显示
问题描述:
我有
EmployeeDetail表包含五个字段
empno,
empname,
city,
地区,
区域
使用这些列绑定gridview
empno,
empname,
city
当鼠标悬停在城市范围内时工具提示上的区域显示
请一步一步给我一个complate解决方案
提前感谢。
I have
EmployeeDetail Table contais five field
empno,
empname,
city,
region,
zone
bind gridview with these columns
empno,
empname,
city
and when mouse over the city field its region and zone display on tooltip
please give me a complate solution step by step
thanks in advance.
答
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[5].Attributes.add("Title",e.Row.Cells[5].Text);
//where cell 5 has the city
}
// Server Side Code
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[5].Attributes.add("onmouseover", "ShowTip(this);");
}
// JavaScript Function
function ShowTip(td)
{
td.title = td.innerText;
}