Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Highlighting DataGrid Rows on mouseOver

Reply
Thread Tools

Highlighting DataGrid Rows on mouseOver

 
 
=?Utf-8?B?V2ViTWF0cml4?=
Guest
Posts: n/a
 
      12-01-2004
Hello,

I need to extend functionality of ASP.NET datagrid. Onmouse over, the whole
row needs to be highlighted. OnClick highlighted color must remain, and the
value of one of the columns must be set to innerHTML property of a <div> tag
(no postBack).
Has anyone done anything like that?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      12-01-2004
Yep try using ItemCreated like below:-

Sub MenuGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles MenuGrid.ItemCreated
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem
Then
e.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='beige';this.style.cur sor='hand'")
e.Item.Attributes.Add("onmouseout",
"this.style.backgroundColor='white';")
End If
End Sub

Hope it helps!!
Patrick



"WebMatrix" wrote:

> Hello,
>
> I need to extend functionality of ASP.NET datagrid. Onmouse over, the whole
> row needs to be highlighted. OnClick highlighted color must remain, and the
> value of one of the columns must be set to innerHTML property of a <div> tag
> (no postBack).
> Has anyone done anything like that?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?V2ViTWF0cml4?=
Guest
Posts: n/a
 
      12-01-2004
Thanks for the prompt reply. I think yoiur code will work for highlighting.
One more question; in this ItemCreated event, can I access a value of a
specific column?
Thank you!

"Patrick.O.Ige" wrote:

> Yep try using ItemCreated like below:-
>
> Sub MenuGrid_ItemCreated(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles MenuGrid.ItemCreated
> If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem
> Then
> e.Item.Attributes.Add("onmouseover",
> "this.style.backgroundColor='beige';this.style.cur sor='hand'")
> e.Item.Attributes.Add("onmouseout",
> "this.style.backgroundColor='white';")
> End If
> End Sub
>
> Hope it helps!!
> Patrick
>
>
>
> "WebMatrix" wrote:
>
> > Hello,
> >
> > I need to extend functionality of ASP.NET datagrid. Onmouse over, the whole
> > row needs to be highlighted. OnClick highlighted color must remain, and the
> > value of one of the columns must be set to innerHTML property of a <div> tag
> > (no postBack).
> > Has anyone done anything like that?

 
Reply With Quote
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      12-01-2004
Yes WebMatrix..
For example by doing (For the first Cell!!):-

e.Item.Cells(1).Attributes.Add("onmouseover",
"this.style.backgroundColor='#DDEEFF'")
e.Item.Cells(1).Attributes.Add("onmouseout",
"this.style.backgroundColor='white'")

Enjoy
Patrick



"WebMatrix" wrote:

> Thanks for the prompt reply. I think yoiur code will work for highlighting.
> One more question; in this ItemCreated event, can I access a value of a
> specific column?
> Thank you!
>
> "Patrick.O.Ige" wrote:
>
> > Yep try using ItemCreated like below:-
> >
> > Sub MenuGrid_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles MenuGrid.ItemCreated
> > If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem
> > Then
> > e.Item.Attributes.Add("onmouseover",
> > "this.style.backgroundColor='beige';this.style.cur sor='hand'")
> > e.Item.Attributes.Add("onmouseout",
> > "this.style.backgroundColor='white';")
> > End If
> > End Sub
> >
> > Hope it helps!!
> > Patrick
> >
> >
> >
> > "WebMatrix" wrote:
> >
> > > Hello,
> > >
> > > I need to extend functionality of ASP.NET datagrid. Onmouse over, the whole
> > > row needs to be highlighted. OnClick highlighted color must remain, and the
> > > value of one of the columns must be set to innerHTML property of a <div> tag
> > > (no postBack).
> > > Has anyone done anything like that?

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-01-2004
If it is a bound column, the value will become known in ItemDataBound event.
You can move all this code over there.

Eliyahu

"WebMatrix" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for the prompt reply. I think yoiur code will work for

highlighting.
> One more question; in this ItemCreated event, can I access a value of a
> specific column?
> Thank you!
>
> "Patrick.O.Ige" wrote:
>
> > Yep try using ItemCreated like below:-
> >
> > Sub MenuGrid_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles

MenuGrid.ItemCreated
> > If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > ListItemType.AlternatingItem Or e.Item.ItemType =

ListItemType.SelectedItem
> > Then
> > e.Item.Attributes.Add("onmouseover",
> > "this.style.backgroundColor='beige';this.style.cur sor='hand'")
> > e.Item.Attributes.Add("onmouseout",
> > "this.style.backgroundColor='white';")
> > End If
> > End Sub
> >
> > Hope it helps!!
> > Patrick
> >
> >
> >
> > "WebMatrix" wrote:
> >
> > > Hello,
> > >
> > > I need to extend functionality of ASP.NET datagrid. Onmouse over, the

whole
> > > row needs to be highlighted. OnClick highlighted color must remain,

and the
> > > value of one of the columns must be set to innerHTML property of a

<div> tag
> > > (no postBack).
> > > Has anyone done anything like that?



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlighting Rows vunet.us@gmail.com Javascript 4 07-16-2007 09:25 PM
Selecting and Highlighting Multiple Rows in a DataGrid Bob Loveshade ASP .Net 1 11-19-2005 09:26 AM
Selecting and Highlighting Multiple Rows in a DataGrid .NETn00b ASP .Net 0 11-19-2005 04:01 AM
Selecting and Highlighting Multiple Rows in a DataGrid .NETn00b ASP .Net Datagrid Control 0 11-19-2005 03:34 AM
Highlighting the cell data in a datagrid.... JohnSmith90 ASP .Net 7 05-13-2005 12:41 PM



Advertisments