# Refresh Datagrid Not Working

**URL:** <https://forum.radzen.com/t/refresh-datagrid-not-working/3904>\
**Category:** Blazor Server\
**Created:** [June 13, 2020, 1:49am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904 "2020-06-13T01:49:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToddB](https://forum.radzen.com/user_avatar/forum.radzen.com/toddb/32/3467_2.png) [@ToddB](https://forum.radzen.com/u/ToddB)\
**Post date:** [June 13, 2020, 1:49am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/1 "2020-06-13T01:49:11Z")

</div>

Hello,

So I have a datagrid that has a checkbox associated - when you click the checkbox, it fires off a stored procedure to update values behind the scenes - then it needs to refresh the datagrid to show the new value.

The changing of the values works perfect - I see in the output that it's happening, and if I refresh, I see the updated data - but otherwise the grid0.Reload(); is not refreshing the data - it's still using the same cache. If I have a sort it'll actually

What do I need to do to reload the data from the database?

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [June 13, 2020, 3:48am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/2 "2020-06-13T03:48:47Z")

</div>

The grid data most probably are retrieved in Load() method - you can execute it to get latest data: `await Load()`.

---

<div class="post-metadata">

**Author:** ![ToddB](https://forum.radzen.com/user_avatar/forum.radzen.com/toddb/32/3467_2.png) [@ToddB](https://forum.radzen.com/u/ToddB)\
**Post date:** [June 14, 2020, 10:43pm UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/3 "2020-06-14T22:43:28Z")

</div>

Tried that - I can redraw the grid but I can't get it to display the changed data until I refresh the whole page.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [June 15, 2020, 4:33am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/4 "2020-06-15T04:33:32Z")

</div>

Please send us example application at [info@rafzen.com](mailto:info@rafzen.com) where we can reproduce and debug your scenario.

---

<div class="post-metadata">

**Author:** ![ToddB](https://forum.radzen.com/user_avatar/forum.radzen.com/toddb/32/3467_2.png) [@ToddB](https://forum.radzen.com/u/ToddB)\
**Post date:** [June 15, 2020, 5:31am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/5 "2020-06-15T05:31:19Z")

</div>

Just sent it your way. The await Load(); probably isn't in there right now but I tried a bunch of different ways with no luck. Thanks for taking a look.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [June 15, 2020, 6:02am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/6 "2020-06-15T06:02:59Z")

</div>

Without await Load(); it will not work

---

<div class="post-metadata">

**Author:** ![ToddB](https://forum.radzen.com/user_avatar/forum.radzen.com/toddb/32/3467_2.png) [@ToddB](https://forum.radzen.com/u/ToddB)\
**Post date:** [June 15, 2020, 6:17am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/7 "2020-06-15T06:17:05Z")

</div>

It was there in a previous version - just put it back and tested... not working. Did it work when you tried it? Or am I putting it in the wrong place?

 ![image](https://forum.radzen.com/uploads/default/original/2X/1/1bbf1a135df567f080bc5d8ff01f682f9b51fc8c.png)

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [June 15, 2020, 6:44am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/8 "2020-06-15T06:44:12Z")

</div>

Yes, I was able to reproduce the problem. Instead `await Load()` you can use `await Context.Entry(data).ReloadAsync();`

 ![image](https://forum.radzen.com/uploads/default/original/2X/a/af51ddab2e4348d32ccff50d65718f694aaaa619.png)  
where `Context` is injected in the page partial class:  
 ![image](https://forum.radzen.com/uploads/default/original/2X/d/da384ee725202711c6782c022b773124e07defca.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/0/05ab35735b6d6cfd7b2c7fec3a914750cb22a026.png)

Honestly I'm not sure why EF Core will not re-query data after this SP execution - Load() method of the page properly calls the service where the latest data will be retrieved from the context.

---

<div class="post-metadata">

**Author:** ![ToddB](https://forum.radzen.com/user_avatar/forum.radzen.com/toddb/32/3467_2.png) [@ToddB](https://forum.radzen.com/u/ToddB)\
**Post date:** [June 15, 2020, 8:05am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/9 "2020-06-15T08:05:49Z")

</div>

Awesome - thank you. I do wonder if there's a better way to execute this than calling a SP - it looks like there's a Grid0RowUpdate method I could try that might do this cleaner? I'm just still figuring out the syntax of the args.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [June 15, 2020, 8:11am UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/10 "2020-06-15T08:11:32Z")

</div>

RowUpdate is tied to in-line editing feature which is not what you are using.

---

<div class="post-metadata">

**Author:** ![opis-kladno](https://forum.radzen.com/letter_avatar_proxy/v4/letter/o/cc9497/32.png) [@opis-kladno](https://forum.radzen.com/u/opis-kladno)\
**Post date:** [December 7, 2021, 2:31pm UTC](https://forum.radzen.com/t/refresh-datagrid-not-working/3904/11 "2021-12-07T14:31:32Z")

</div>

I have the same problem. When I change datasource and force redraw form via StateHasChanged. I see always old data. It seems that ItemsProviderDelegate in method DrawRows does not call LoadItems in consequent calls. It is correct only during first call.
