ASP.NET 2.0 GridView Item Selection

A

ABHIJIT B

Hi,

I am using GridView in my web page.In that form after clicking Add
button I am again binding GridView with newly added record.

The problem I am facing is how to highlight newly inserted data in
GridView.

Regards,
Abhijit B
 
S

S. Justin Gengo

Abhijit,

I would suggest using the GridView's RowDatabound event which fires every
time a row's data is bound. Within that event handler subroutine you will
have access to the rows information and separate cells. You'll be able to
identify which is the new row. For example here is how you could check the
text in the third cell of a row:

If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(2).Text = "My Text" Then
'---Text was found
End If
End If

Then when you know you have the right row you can set the row's background
color via its style property or via your own css stylesheet by changing the
row's css class: e.Row.Style or e.Row.CssClass

--
Sincerely,

S. Justin Gengo, MCP

Free code and component libraries at:
http://www.aboutfortunate.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top