Home All Groups Group Topic Archive Search About

Highlight row in a gridview after formview insert

Author
9 Jan 2006 10:46 PM
Feege
I am using a formview to insert a new record into a gridview.

After the insert is done, I want to highlight the new record.

I have written some code to do this which is called on the
"OnItemInserted" event on the formview

GridView1.DataBind()
GridView1.PageIndex = 1
Dim Row As GridViewRow = GridView1.Rows(5)
Row.Style("background-color") = "#FF3333"

The pageindex works, but the highlighting of the row does not work.

Any ideas ?

Thanks

Geoff

Author
11 Jan 2006 6:38 PM
Wouter van Vugt
Hi Geoff,

I'd probably use the built in SelectedRowStyle to highlight the row,
Just select the newly inserted item in the postback. You might also
want to change the highlight color do differ from the normal selected
item color, also in the postback code.

Grtz,

Wouter van Vugt
Trainer - Info Support
http://blogs.infosupport.com/wouterv
Are all your drivers up to date? click for free checkup

Author
11 Jan 2006 6:40 PM
Wouter van Vugt
Or derive from GridView and implement an extra style which you can use,
e.g. this is the harder way.

Grtz,

Wouter van Vugt
Trainer - Info Support
http://blogs.infosupport.com/wouterv

Bookmark and Share

Post Thread options