473,763 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="onmouseo ver=this.bgcolo r=#ff0000; onmouseout=this .bgcolor=#00ff0 0;"

Binding is done in C# page

..aspx page code

<%@ Page language="c#" Codebehind="fil ename.aspx.cs" AutoEventWireup ="false" Inherits="filen ame" %

Nov 18 '05 #1
1 1830
Hi, Michae

First, this is not correct in HTML
<tr style="onmouseo ver=this.bgcolo r=#ff0000; onmouseout=this .bgcolor=#00ff0 0;"
It should be
<tr onmouseover="th is.bgColor='#ff 0000';" onmouseout="thi s.bgColor='#00f f00';""
Which you can add in ItemDataBound Event of the grid, like
void DataGrid2_ItemD ataBound(Object sender, System.Web.UI.W ebControls.Data GridItemEventAr gs e)

if (e.Item.ItemTyp e == ListItemType.It em || e.Item.ItemType == ListItemType.Al ternatingItem

e.Item.Attribut es("onmouseover ") = "this.bgColor=' #ff0000'"
e.Item.Attribut es("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
1354
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 inside a form tag But ignoring that, with my asp:DataGrid how can I have a column of values each with a link e.g. <a href="Details.aspx?id=" + MY_NBR>MY_NBR</a>
2
1289
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 tables. However, I am trying to use a data bound DataGrid and can't seem to figure out how to set the class for the first row. Any insight would be appreiciated.
15
3765
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. How do i hide a column? Thanks. MyConnection = New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes") MyCommand = New SqlDataAdapter("select * from Authors",
4
2137
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 Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click gets connected to the C# code,
0
9566
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9389
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10149
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9943
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9828
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7370
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5271
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5410
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3918
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.