locked
Hight light Grid View When New Data Was Inserted RRS feed

  • Question

  • User1109811461 posted

    hi all expertise

    i want my gridview hight light yellow color when the new data was inserted,

    i need to implement this because it will make the user confius which data is new and which data is old,

    i hope expertise here can help me..Smile

    Monday, December 24, 2012 7:08 PM

Answers

  • User3866881 posted

    GridView.Rows[0].BackColor=Red or Yellow.

    Just change to this:

    GridView.Rows[GridView.Rows.Count-1].BackColor=Red or Yellow;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 26, 2012 12:10 AM

All replies

  • User-1716253493 posted

    If you are using ID autoincreament primary key, you can sort the data by ID desc. New record will always on top.

    Monday, December 24, 2012 7:54 PM
  • User3866881 posted

    Hello,

    GridView doesn't support inserting. So I think you can just:

    1) Place several TextBoxes outside the GridView, and with a button beside.

    2) Then when inserting a record successfully, please just set GridView.Rows[0].BackColor=Red or Yellow.

    Reguards!

    Tuesday, December 25, 2012 8:24 PM
  • User1109811461 posted

    hi decker thanks for reply

    my insert form is different with the gridview, i already do it, but not work in my site,

    i'm doing insert in register.aspx page, after that the user can view the success insertion in listUser.aspx

    i put this code below in page_load

    GridView.Rows[0].BackColor=Red or Yellow.

    this code above just change the color the first rows of the gridview, if the new insertion go to row number 5, how it can be done..?

    i display this grid view by using A-Z method

    Wednesday, December 26, 2012 12:03 AM
  • User3866881 posted

    GridView.Rows[0].BackColor=Red or Yellow.

    Just change to this:

    GridView.Rows[GridView.Rows.Count-1].BackColor=Red or Yellow;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 26, 2012 12:10 AM
  • User1109811461 posted

    hi decker

    now it work on my site, just want to know, the data that display in my gridview is sort by ascending, so i want to make the new insert hight light, see example below:, if this is diffucult, i will continue by using the code that has been given by your before this, but i really glad if you can help by doing as i explain..

    Cristoper Michael

    Cristopher

    David Teo

    David Tiong (New Data Insert), want to hightlight this data 

    Eric Liong

    Eric Farnandez

     

     

    Wednesday, December 26, 2012 1:30 AM
  • User-1716253493 posted

    You need additional datasource to check the latest data, for example MAX(ID).

    In Gridview rowdatabound event, compare the value with current row value. If equal then change row color.

    Wednesday, December 26, 2012 1:38 AM
  • User3866881 posted

    Hi again,

    Some ideas:

    1) Please make sure that there's at least one identitied column stepped from 1 to 1.

    2) After inserting, please find out the maxinum Id of your record in GridView's Rows, and then mark it colored.

    Sunday, December 30, 2012 8:13 PM