C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Highlight Datagrid or GridView row on mouse over


Posted Date: 20 Feb 2008    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: KamalMember Level: Gold    
Rating: 1 out of 5Points: 10



Add handler for RowCreated/RowDataBound event for the grid and in this event add the attributes for onmouseover and onmouseout javascript events.

Code :

If e.Row.RowType = DataControlRowType.DataRow Then

Dim gv As GridView = CType(sender, GridView)

Dim className As String = Microsoft.VisualBasic.IIf((e.Row.RowState = DataControlRowState.Alternate), gv.AlternatingRowStyle.CssClass, gv.RowStyle.CssClass)

e.Row.Attributes.Add("onmouseover", "this.className='datagrid_hovcol';")

e.Row.Attributes.Add("onmouseout", "this.className='" + className + "';")

End If


In this code "onmouseover" specify classname directly. And in "onmouseout" find dynamically which class is specify for Normal /Alternative Row.

And also this code for highlight row.But if you want to highlight particular cell of row then change

e.Row.Cells(1).Attributes.Add("onmouseover", "this.className='datagrid_hovcol';")

e.Row.Cells(1).Attributes.Add("onmouseout", "this.className='" + className + "';")





Responses

Author: sreejith    21 Feb 2008Member Level: Silver   Points : 0
its really nice to read the article.simple presentation. really good.

sreejithsql@gmail.com


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Nested Master pages in VS2008
Previous Resource: Enable/Disable RequiredFieldValidator with Javascript
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use