Onmouseover row in datagrid

Source: Internet
Author: User
I'm using several datagrids where the user can select the row by clicking
Anywhere on that row. I 'd like to be able to show the hand cursor when
Mousing over databound rows. Does anyone know how to do this?

Will

Reply to this message...
 
Coke, Derek
Will

You can use the cursor property of the style object in DHTML. You will need
To code something like the following server sideAddThe required Client
Side attribute.

Myrow.Attributes.Add("Onmouseover", "This. style. cursor = 'hand '")

Which will produce HTML on the client as below
<Tr onmouseover = "This. style. cursor = 'hand'">

Derek

----- Original message -----
From: Will Currie [mailto: Click here to reveal e-mail address]
Sent: 13 May 2002
To: aspngclient
Subject: [aspngclient] onmouseover row in datagrid

-- Copied from [aspngdatagridrepeaterdatalist] to [aspngclient] By Marcie
Jones <click here to reveal e-mail address> --

I'm using several datagrids where the user can select the row by clicking
Anywhere on that row. I 'd like to be able to show the hand cursor when
Mousing over databound rows. Does anyone know how to do this?

Will
| [Aspngclient] member click here to reveal e-mail address = your ID
| Http://www.aspfriends.com/aspfriends/aspngclient.asp = join/quit

========================================================== ====================================
Information in this email and any attachments are confidential, and may
Not be copied or used by anyone other thanAddRessee, nor disclosed
To any third party without our permission. There is no intention
Create any legally binding contract or other commitment through the use
Of this email.

Experian Limited (regiation number 653331 ).
Registered Office: Talbot house, Talbot Street, Nottingham ng1 5hf

Reply to this message...
 
Matt Serdar
I 've stayed away from DataGrid's for this very reason. I use Repeaters
Instead and Add Mouse events to my <tr> tags that get wrapped inside
<Itemtemplate> tags.
So, it wowould look something like this.

<Itemtemplate>
<Tr onmouseover = "javascript: This. style. backgroundcolor = '# ffffcc ';
This. style. cursor = 'hand'; return true ;"
Onmouseout = "javascript: This. style. backgroundcolor = '';
This. style. cursor = 'default'; this. style. backgroundcolor = ''; return true;">
<TD style = "PAddIng-left: 7px "> <nobr> <% # container. dataitem (" personlastname ")
%> </Nobr> </TD>
</Tr>
</Itemtemplate>

Hth

Matt

----- Original message -----
From: Will Currie [mailto: Click here to reveal e-mail address]
Sent: Monday, May 13,200 2 AM
To: aspngclient
Subject: [aspngclient] onmouseover row in datagrid

-- Copied from [aspngdatagridrepeaterdatalist] to [aspngclient] By Marcie
Jones <click here to reveal e-mail address> --

I'm using several datagrids where the user can select the row by clicking
Anywhere on that row. I 'd like to be able to show the hand cursor when
Mousing over databound rows. Does anyone know how to do this?

Will
| [Aspngclient] member click here to reveal e-mail address = your ID
| Http://www.aspfriends.com/aspfriends/aspngclient.asp = join/quit

Reply to this message...
 
Will Currie
This is working fine for me in the DataGrid

Private sub datagrid1 _Itemdatabound(Byval sender as object, byval e
System. Web. UI. webcontrols. datagriditemeventargs) handles
Datagrid1.Itemdatabound

Dim itemtype as listitemtype = E. Item. itemtype
If (itemtype = listitemtype. pager) or (itemtype = listitemtype. header)
Or (itemtype = listitemtype. footer) then
Return
Else
Dim button as linkbutton = ctype (E. Item. cells (1). Controls (0 ),
Linkbutton)
E. Item.Attributes("Onclick") = page. getpostbackclienthyperlink (button,
"")
E. Item.Attributes.Add("Onmouseover ",
"This. style. cursor = 'hand'; this. classname = 'altrow ';")
E. Item.Attributes.Add("Onmouseout", "This. classname = 'linkrow ';")
End if
End sub

It enables the row to be selected by clicking anywhere on it and also does
The Mouseover stuff too.

Will

----- Original message -----
From: Matt Serdar [mailto: Click here to reveal e-mail address]
Sent: 13 May 2002
To: aspngclient
Subject: [aspngclient] re: onmouseover row in datagrid

I 've stayed away from DataGrid's for this very reason. I use Repeaters
Instead andAddMouse events to my <tr> tags that get wrapped inside
<Itemtemplate> tags.
So, it wowould look something like this.

<Itemtemplate>
<Tr onmouseover = "javascript: This. style. backgroundcolor = '# ffffcc ';
This. style. cursor = 'hand'; return true ;"
Onmouseout = "javascript: This. style. backgroundcolor = '';
This. style. cursor = 'default'; this. style. backgroundcolor = ''; return true;">
<TD style = "PAddIng-left: 7px "> <nobr> <% # container. dataitem (" personlastname ")
%> </Nobr> </TD>
</Tr>
</Itemtemplate>

Hth

Matt

----- Original message -----
From: Will Currie [mailto: Click here to reveal e-mail address]
Sent: Monday, May 13,200 2 AM
To: aspngclient
Subject: [aspngclient] onmouseover row in datagrid

-- Copied from [aspngdatagridrepeaterdatalist] to [aspngclient] By Marcie
Jones <click here to reveal e-mail address> --

I'm using several datagrids where the user can select the row by clicking
Anywhere on that row. I 'd like to be able to show the hand cursor when
Mousing over databound rows. Does anyone know how to do this?

Will
| [Aspngclient] member click here to reveal e-mail address = your ID
| Http://www.aspfriends.com/aspfriends/aspngclient.asp = join/quit

| [Aspngclient] member click here to reveal e-mail address = your ID
| Http://www.aspfriends.com/aspfriends/aspngclient.asp = join/quit

Reply to this message...
 
Matt Serdar
That looks really good will.
Is the linkbutton required just for The onclick event? Does it basically
Make the entire row clickable?

Matt

----- Original message -----
From: Will Currie [mailto: Click here to reveal e-mail address]
Sent: Monday, May 13,200 2 AM
To: aspngclient
Subject: [aspngclient] re: onmouseover row in datagrid

This is working fine for me in the DataGrid

Private sub datagrid1 _Itemdatabound(Byval sender as object, byval e
System. Web. UI. webcontrols. datagriditemeventargs) handles
Datagrid1.Itemdatabound

Dim itemtype as listitemtype = E. Item. itemtype
If (itemtype = listitemtype. pager) or (itemtype = listitemtype. header)
Or (itemtype = listitemtype. footer) then
Return
Else
Dim button as linkbutton = ctype (E. Item. cells (1). Controls (0 ),
Linkbutton)
E. Item.Attributes("Onclick") = page. getpostbackclienthyperlink (button,
"")
E. Item.Attributes.Add("Onmouseover ",
"This. style. cursor = 'hand'; this. classname = 'altrow ';")
E. Item.Attributes.Add("Onmouseout", "This. classname = 'linkrow ';")
End if
End sub

It enables the row to be selected by clicking anywhere on it and also does
The Mouseover stuff too.

Will

Reply to this message...
 
Will Currie
Yes this makes the entire row clickable/selectable.
The link button exists in column 1 of the DG but its visibility is set
False. The only column I have visible is a template column with some fancy
DHTML in it. This solution works fine even in the template column.
Mouseover hand gives the user better feedback.

----- Original message -----
From: Matt Serdar [mailto: Click here to reveal e-mail address]
Sent: 13 May 2002
To: aspngclient
Subject: [aspngclient] re: onmouseover row in datagrid

That looks really good will.
Is the linkbutton required just for The onclick event? Does it basically
Make the entire row clickable?

Matt

----- Original message -----
From: Will Currie [mailto: Click here to reveal e-mail address]
Sent: Monday, May 13,200 2 AM
To: aspngclient
Subject: [aspngclient] re: onmouseover row in datagrid

This is working fine for me in the DataGrid

Private sub datagrid1 _Itemdatabound(Byval sender as object, byval e
System. Web. UI. webcontrols. datagriditemeventargs) handles
Datagrid1.Itemdatabound

Dim itemtype as listitemtype = E. Item. itemtype
If (itemtype = listitemtype. pager) or (itemtype = listitemtype. header)
Or (itemtype = listitemtype. footer) then
Return
Else
Dim button as linkbutton = ctype (E. Item. cells (1). Controls (0 ),
Linkbutton)
E. Item.Attributes("Onclick") = page. getpostbackclienthyperlink (button,
"")
E. Item.Attributes.Add("Onmouseover ",
"This. style. cursor = 'hand'; this. classname = 'altrow ';")
E. Item.Attributes.Add("Onmouseout", "This. classname = 'linkrow ';")
End if
End sub

It enables the row to be selected by clicking anywhere on it and also does
The Mouseover stuff too.

Will

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.