473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

asp:datagrid style on mouseover mouseout

Hi

I am trying to add mouseover property to asp:datagrid in the asp .net page
My pag
So the output in HTML for a row should look like

<tr style="onmouseover=this.bgcolor=#ff0000; onmouseout=this.bgcolor=#00ff00;"

Binding is done in C# page

..aspx page code

<%@ Page language="c#" Codebehind="filename.aspx.cs" AutoEventWireup="false" Inherits="filename" %

Nov 18 '05 #1
1 1819
Hi, Michae

First, this is not correct in HTML
<tr style="onmouseover=this.bgcolor=#ff0000; onmouseout=this.bgcolor=#00ff00;"
It should be
<tr onmouseover="this.bgColor='#ff0000';" onmouseout="this.bgColor='#00ff00';""
Which you can add in ItemDataBound Event of the grid, like
void DataGrid2_ItemDataBound(Object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem

e.Item.Attributes("onmouseover") = "this.bgColor='#ff0000'"
e.Item.Attributes("onmouseout") = "this.bgColor='#00ff00'"

Hope this help

Bin Song, MC

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim Smith | last post by:
In my .cs code I populate set the DataSource appropriately and I can get my DataGrid to appear, though sorting throws an error 'dgDataGrid1__ctl1__ctl0' of type 'DataGridLinkButton' must be placed...
2
by: John | last post by:
Hi, First off .. I am very new to ASP.NET (.NET in general), so this may be a very basic question. I have traditionally used a set of style classes for html tables and the first row in those...
15
by: John Blair | last post by:
Hi, Code attached but the line that gives me an error is MyDataGrid.Columns(2).Visible = False It actually gives me an error for any value instead of 2 even when 9 bound columns of data exist....
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.