CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: NewsGroup Date Entered: 11/9/2006 11:31:53 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 86 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
KenA
Asp.Net User
Changing GridView Row Color OnMouseOver11/9/2006 11:31:53 AM

0/0

Hi. In the gridview rowcreated or rowdatabound event I added the following code in order to add some 'cosmetic' behaviour, but with no luck at all.

protected void gvw01_RowDataBound( object sender, GridViewRowEventArgs e )
{
	if( e.Row.RowType == DataControlRowType.DataRow )
	{
		if( e.Row.RowState == DataControlRowState.Normal )
		{
			e.Row.Attributes.Add( "onmouseover", "this.style.backgroundColor='DeepSkyBlue'" );
			e.Row.Attributes.Add( "onmouseout", "this.style.backgroundColor='#DDDDDD'" );
		}
		else if( e.Row.RowState == DataControlRowState.Alternate )
		{
			e.Row.Attributes.Add( "onmouseover", "this.style.backgroundColor='DeepSkyBlue'" );
			e.Row.Attributes.Add( "onmouseout", "this.style.backgroundColor='#FFFFFF'" );
		}
	}
}
 

Any tips on this would be appreciated

 


??? KenA
Russ Helfand
Asp.Net User
Re: Changing GridView Row Color OnMouseOver11/10/2006 10:56:24 PM

0/0

Hi Ken,

Just thinking off the cuff here....

If you add these values to the Attributes collection here then it seems like you'd want to enhance your version of GridViewAdapter.cs to actually write out (render) these attributes.  Right?

So, when the adapter gets a row, I think you're going to want to add a chunk of code (in the adapter) that essentially says... if Attributes["onmouseover"] isn't null or empty then add an attribute to the <tr> being written out right now by the adapter using...

writer.WriteAttribute("onmouseover", row.Attributes["onmouseover"].Value.ToString());

or some such nonesense.  I'm not quite sure about the "Value.ToString()" piece of that.  You might need a slightly different syntax.


Russ Helfand
Groovybits.com
lacos
Asp.Net User
Re: Changing GridView Row Color OnMouseOver10/25/2007 9:00:38 PM

0/0

Hi KenA,

You can try this:

 protected void gvw01_RowDataBound( object sender, GridViewRowEventArgs e )
 {
 if( e.Row.RowType == DataControlRowType.DataRow )
{

if (e.Row.RowIndex % 2 == 1){

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#DDDDDD'");

}else{

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");

}

e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='DeepSkyBlue'");

 }

}

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET 2.0 MVP Hacks and Tips Authors: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan Goodyear, Pages: 400, Published: 2006
ASP.NET AJAX UpdatePanel Control Authors: Bertrand Le Roy, Matt Gibbs, Pages: 0, Published: 2007

Web:
GridViewGuy Changing GridView Row Color OnMouseOver. By AzamSharp Views: 18887. Introduction :. Few months ago I wrote an article about how you can change the row color ...
Changing GridView Row Color OnMouseOver - ASP.NET Forums Re: Changing GridView Row Color OnMouseOver. 11-10-2006, 5:56 PM. Contact ... Re : Changing GridView Row Color OnMouseOver. 10-25-2007, 5:00 PM. Contact ...
GridView Row Color Change On MouseOver - KrisSteele.net GridView Row Color Change On MouseOver. 8/7/2008 (3) ... If I needed more advanced functionality than just changing colors on mouse over/out, ...
ASP.NET Changing GridView Row Color OnMouseClick:/OnMouseOver: Feb 28, 2007 ... Changing GridView Row Color OnMouseOver: This article explains that how you can change the GridView row color when the mouse cursor is ...
Changing Row Color of the GridView Control on mouse over Apr 11, 2006 ... Changing Row Color of the GridView Control on mouse over. Few months back I blogged about changing the Back Color of the row contained in ...
GridViewGuy Changing Color of GridView OnMouseOver. By AzamSharp Views: 9187 ... change the color of the GridView row by attaching the onmouseover event to the rows. ...
gridview row colour changing Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'"); // This will be the back ground color of the GridView Control ...
how to change gridview hyperlinkfield column font color on row ... how to change gridview hyperlinkfield column font color on row mouseover. Last post 09-25-2008 8:05 AM by Ganesh@Nilgris. 8 replies. Sort Posts: ...
Changing the Row Color on the mouseover event in GridView Control Changing the Row Color on the mouseover event in GridView Control. Pretty simple idea to change the row color of the GridView control on the onmouseover ...
Changing GridView Row Color OnMouseOver - stswordman - 博客园 文章介绍了鼠标在GridView控件的行间移动时改变行间颜色的技术.




Search This Site:










creating ssl (https) web application

current skin folder base path

frontpage extensions and ftp

domain mapping for new parent portal

how to: make "export to excel" always open excel in a separate window

how to retrieve current aspx file name ?

dnn 3.0.13 after install error an unhandled error has occurred

problem in using horizontal style

3.0.10 issue: announcements module

css frindly adapters - how to apply skin?

need help with the web.config

multiple portals, separate databases, same users, one log in ?? possible?

netscape compatible menu

site maps

enabling search on non-core modules ?

masked domain problem (dnn 2.1.2)

start up for .net security

suggestion to avoid modification to the core

displaying a simple user control in a module.

no data coming back

can i carry vbscript in included .asp files forward into .aspx pages?

allowing user to personalize css

good expanding side menu

create new user

multipage/tabstrip dynamic usercontrol dilemma

custom module, no print output?

how to utilize google gmail server in your.net windows applications

user authentication method of asp.net. is my choice right?

newblog, child blog content to appear on separate page

could we use vs 2005 image library in our apps ?

 
All Times Are GMT