This is a migrated thread and some comments may be shown as answers.

Grid Not Updating unless Scrolled or Sorted

4 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe Sugden
Top achievements
Rank 1
Joe Sugden asked on 13 Dec 2010, 03:39 PM
Hello,

Has anyone seen the following behavior:

We have a grid (2010Q3), there is a column with decimal numbers, we update the data in the column in code but the grid won't show the new numbers unless you scroll up and down, or sort. We tried calling .Refresh or .Update on the grid but it did not help...

Any ideas?

See attached screenshot for details.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 13 Dec 2010, 04:11 PM
Hi Joe,

How are you performing the change? Have a look at this really simple examle below. It's just assuming there is a RadgridView and a RadButton on a form. The value updates without having to call any additional code.

Private Sub Form1_Load(ByVal sender As System.Object,
                       ByVal e As System.EventArgs) Handles MyBase.Load
    Me.RadGridView1.MultiSelect = True
    Me.RadGridView1.AllowRowResize = False
    Me.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
    Me.RadGridView1.Columns.Add(New GridViewTextBoxColumn("A"))
    Me.RadGridView1.Columns.Add(New GridViewDecimalColumn("B"))
    Dim rowInfo As GridViewRowInfo = Me.RadGridView1.Rows.AddNew()
    rowInfo.Cells(0).Value = "A1"
    rowInfo.Cells(1).Value = 2.99
    rowInfo = Me.RadGridView1.Rows.AddNew()
    rowInfo.Cells(0).Value = "A2"
    rowInfo.Cells(1).Value = 3.99
End Sub
Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
    Me.RadGridView1.Rows(0).Cells(1).Value = 5.75
End Sub

Hope that helps
richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 13 Dec 2010, 04:13 PM
Joe,

As an additional, if your value is refreshing when you scroll, you may want to try calling
InvalidateRow() on the row that you are performing the update on. This should kick off the rowFormatting event which also happens when you scroll.

richard
0
Joe Sugden
Top achievements
Rank 1
answered on 13 Dec 2010, 05:13 PM
Looks like InvalidateRow() did the trick, thanks!
0
Richard Slade
Top achievements
Rank 2
answered on 13 Dec 2010, 05:15 PM
Glad that helped joe. Please remember to mark as answer.
All the best
Richard
Tags
GridView
Asked by
Joe Sugden
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Joe Sugden
Top achievements
Rank 1
Share this question
or