protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.DataRow) | (e.Row.RowType == DataControlRowType.Header)) {
foreach (DataControlFieldCell GridViewDataControlFieldCell in e.Row.Cells) {
//Remove any hidden hyphens that might be in the header.
string GridViewHeaderText = GridViewDataControlFieldCell.ContainingField.HeaderText.Replace(Strings.Chr(173), "");
if (e.Row.RowType == DataControlRowType.DataRow) {
GridViewDataControlFieldCell.Attributes.Add("Title", GridViewHeaderText);
GridViewDataControlFieldCell.Attributes.Add("onmouseover", "this.bgColor='lightyellow'");
GridViewDataControlFieldCell.Attributes.Add("onmouseout", "this.bgColor=''");
} else {
GridViewDataControlFieldCell.Attributes.Add("Title", "Click link to sort by " + GridViewHeaderText);
}
}
}
}
Display header in GridView cell when mouse pointer hovers over it
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment