IT Community - Software Programming, Web Development and Technical Support

How to add mouseover function to Gridview..?

This is a discussion on How to add mouseover function to Gridview..? within the C# Programming forums, part of the Software Development category; Content: How to add mouseover function to Gridview( To change the color of the row while mouse over in gridview)...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-19-2007, 10:53 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default How to add mouseover function to Gridview..?

Content: How to add mouseover function to Gridview( To change the color of the row while mouse over in gridview)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-20-2007, 12:40 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Thumbs up Re: How to add mouseover function to Gridview..?

Hi friend, Here is the answer..
<asp:GridView ID="employeeGridView" OnRowCreated="MyGridView_RowCreated">
protected void MyGridView_RowCreated(object sender, GridViewRowEventArgs e)
{

string onmouseoverStyle = "this.style.backgroundColor='#dcdcdc'";

string onmouseoutStyle = "this.style.backgroundColor='@BackColor'";

string rowBackColor = String.Empty;

if (e.Row.RowType == DataControlRowType.DataRow)
{

if (e.Row.RowState == DataControlRowState.Alternate)

rowBackColor = System.Drawing.ColorTranslator.ToHtml(employeeGrid View.AlternatingRowStyle.BackColor).ToString();

else rowBackColor = System.Drawing.ColorTranslator.ToHtml(employeeGrid View.RowStyle.BackColor).ToString();

e.Row.Attributes.Add("onmouseover", onmouseoverStyle);

e.Row.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor));

}

}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting GridView to Excel shaalini ASP and ASP.NET Programming 4 03-26-2008 02:23 AM
GridView.DataBind not working rrrajesh84in ASP and ASP.NET Programming 1 03-21-2008 10:01 PM
Which is the best among DataList,Repeater and GridView and Why? poornima ASP and ASP.NET Programming 2 03-14-2008 08:44 PM
GridView Item Tempalte Problem shaalini C# Programming 0 01-29-2008 09:11 PM
Diff inline function and ordinary function vigneshgets C and C++ Programming 1 05-24-2007 11:34 AM


All times are GMT -7. The time now is 09:46 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0