473,386 Members | 1,785 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,386 software developers and data experts.

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 1191
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gerg | last post by:
The datagrid has a tablestyle applied to it, and there are DataGridTextBoxColumn and each DataGridTextBoxColumn has an array of DataGridTextBox objects. Private Sub highlight(ByVal str As...
4
by: mike | last post by:
I'm trying to highlight a specific row in a datagrid who's contition matches ..text = "Dawn" i've been playing with the code below without much luck, is there a foreach loop i could do, like (...
1
by: TJS | last post by:
trying to use this code for mouseover highlight of row but it is not working on the datagrid, nothing happens. Page compiles without errors but no highlighting effects take place. can anyone...
4
by: Grey | last post by:
i know how to highlight row in the datagrid, but how to deselect the row when user click another one.
4
by: Chris | last post by:
I've searched, reviewed, and attempted dozens of code ideas on the subject. I can't seem to get something that seems so simple to work. To highlight a row in a datagrid based on another value in...
6
by: LU | last post by:
A)I build a datagrid based on a calendar date selection. B)When user clicks a button column on the datagrid I want to highlight this row. I use the code below to highlight the row. ***** CODE...
2
by: Geraldine Hobley | last post by:
Hello I have a datagrid, called MyDataGrid and I wish to put the focus on a particular cell in order that the user to highlight the fact that the user needs to enter a value in this cell, e.g. I put...
0
by: Savvas | last post by:
Hi, I am using VB.Net 2005 for a windows application. The application was actually upgraded from vb.net 2003. I have a search field which is used as a parameter to search all datagrid...
0
by: rn5a | last post by:
How to highlight a row in a DataGrid that has just been edited? EditItemStyle-BackColor will highlight a row when the DataGrid (& a row) is in the editable mode. I want to highlight the row...
0
by: Nhan | last post by:
hi everyone, I have an interesting question to ask. I had created a datagrid to display the data from a .xls file. I want to highlight the rows which has the first three fields are the same. for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.