469,919 Members | 2,152 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,919 developers. It's quick & easy.

Highlight a datagrid

I want to highlight a row in a ASP.NET datagrid when i
click on it ?

How can i do that?
Nov 22 '05 #1
2 1099
You can add some code in your ItemDataBound event,like
this:

if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType
== ListItemType.AlternatingItem){
e.Item.Attributes.Add
("onclick","this.style.backgroundColor='Silver' ");
}
-----Original Message-----
I want to highlight a row in a ASP.NET datagrid when i
click on it ?

How can i do that?
.

Nov 22 '05 #2
Thank you, it is working fine.
but i want the row which i clicked to be highlighted
for example if i click 1 row it should get highlighted
then if i click 2 row 1st row should be in the default
format and 2nd row should get highlighted.

How can i achieve this?

Thank you

-----Original Message-----
You can add some code in your ItemDataBound event,like
this:

if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType== ListItemType.AlternatingItem){
e.Item.Attributes.Add
("onclick","this.style.backgroundColor='Silver'") ;
}
-----Original Message-----
I want to highlight a row in a ASP.NET datagrid when i
click on it ?

How can i do that?
.

.

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by TJS | last post: by
4 posts views Thread by Grey | last post: by
4 posts views Thread by Chris | last post: by
6 posts views Thread by LU | last post: by
2 posts views Thread by Geraldine Hobley | last post: by
reply views Thread by Savvas | last post: by
reply views Thread by rn5a | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.