Programmers heavily use the asp.net gridview control. Adding some effects to the gridview will change the appearance so that user interactivity increases. One of such effects is highlighting the gridview row on mouseover. With this short background let's go for the design markup of the example gridview.
- <asp:GridView ID="gridTest" runat="server" OnRowDataBound="gridTest_RowDataBound" AutoGenerateColumns="false">
- <Columns>
- <asp:BoundField HeaderText="Status" DataField="Status" />
- <asp:BoundField HeaderText="Name" DataField="Name" />
- <asp:BoundField HeaderText="Comment" DataField="Comment" />
- <asp:BoundField HeaderText="Date" DataField="Date" />
- </Columns>
- </asp:GridView>
- //row created event
- protected void gridTest_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Attributes.Add("onmouseover", "this.className='highlightrow'");
- e.Row.Attributes.Add("onmouseout", "this.className='normalrow'");
- }
- }