protected void OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(GView, "Select$" + e.Row.RowIndex); e.Row.ToolTip = "Click to select this row."; } } protected void OnSelectedIndexChanged(object sender, EventArgs e) { foreach (GridViewRow row in GView.Rows) { if (row.RowIndex == GView.SelectedIndex) { row.BackColor = ColorTranslator.FromHtml("#A1DCF2"); row.ToolTip = string.Empty; txtUID.Text = GView.Rows[0].Cells[0].Text; } else { row.BackColor = ColorTranslator.FromHtml("#FFFFFF"); row.ToolTip = "Click to select this row."; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)