Content in the rowbound event of the gridview
Protected void gridview1_rowdatabound (Object sender, gridviewroweventargs E)
...{
If (E. Row. rowtype = datacontrolrowtype. datarow)
...{
// Dataset DS = new dataset ();
For (INT I = 0; I <E. Row. cells. Count; I ++)
...{
String table = "<Table cellspacing = '0' rules = 'all' bordercolorlight = '# b4b1b1 'bordercolordark =' # ffffff' border = '1'> <tr class = 'title '> <TD> data source </TD> <TD> "+ gridview1.columns [I]. headertext. tostring () + "</TD> </tr> ";
Xmldocument xmldoc = new xmldocument ();
Xmldoc. loadxml (lbhiddengrid. Text );
// Xmldoc. selectsinglenode ("/datas/Notes [@ ID = '" + I + "']/source [@ DESC = 'testing']/data/year ");
// Xmldoc. selectsinglenode ("/datas/Notes [@ ID = '" + I + "']/source [@ DESC = 'testing']/data/year "). firstchild. value
Foreach (xmlnode childnode in xmldoc. selectsinglenode ("/datas/Notes [@ ID = '" + E. Row. rowindex. tostring () + "']")
...{
// Xmlnode childnode = xmldoc. selectsinglenode ("/datas/Notes [@ ID = '" + E. Row. rowindex. tostring () + "']");
// For (Int J = 0; j <xmldoc. selectsinglenode ("/datas/Notes [@ ID = '" + E. row. rowindex. tostring () + "']"). childnodes. count; j ++)
//{
Table + = "<tr> <TD> ";
String name = childnode. Attributes. getnameditem ("DESC"). innertext;
Table + = Name + "</TD> <TD> ";
String value = childnode. selectsinglenode ("Data/" + (boundfield) (gridview1.columns [I]). datafield). innertext;
Table + = value + "</TD> </tr> ";
// Childnode. selectsinglenode ("/data /");
// Ds. readxml (xmlreader. Create (new system. Io. stringreader (childnode. firstchild. outerxml )));
//}
}
Table + = "</table> ";
// String Ss = server. htmlencode (table );
E. Row. cells [I]. Attributes. Add ("onmouseover", "showdivbycs (" "+ Table + "")");
E. Row. cells [I]. Attributes. Add ("onmouseout", "remove ()");
}
}
}
Content in Javascript
// Display the DIV when the cursor passes
Function showdivbycs (table )...{
// Table = table. Replace ("& amp ;","&");
// Table = table. Replace ("& gt;", "> ");
// Table = table. Replace ("& lt;", "<");
// Table = table. Replace ("& quot ;",""");
// Table = table. Replace ("& apos ;","'");
VaR x = Window. event. X;
Var y = Window. event. Y;
VaR show = Document. getelementbyid ("showinfo ");
Show. style. Visibility = "visible ";
Show. style. Top = y;
Show. style. Left = X;
Show. style. Background = "# FFFF00 ";
// Read XML
Document. getelementbyid ("SP"). innerhtml = table;
// Div follows the mouse
Document. onmousemove = movetomouseloc;
}
// When the mouse moves, the DIV follows
Function movetomouseloc (E)
...{
X = Window. event. X;
Y = Window. event. Y;
VaR show = Document. getelementbyid ("showinfo ");
Show. style. Left = X;
Show. style. Top = y;
Return true;
}