Code2night
  • Home
  • Guest Posts
  • Tutorial
  • Languages
    • Angular
    • C
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
    • Word Counter
    • Base64 Encode/Decode
    • Diff Checker
    • JSON to CSV
    • Password Generator
  • Register
  • Login
  1. Home
  2. Blogpost

Changing sfgrid datasource does not work in Blazor

Date- Jun 11,2022

5749

Blazor Syncfusion


SFGrid in Blazor

SFGrid is a grid component provided by synfcusion that we use in blazor to create grid's that have some amazing features like incremental search, agreggate sum, pagination and many more column formatting.

The issue occurs when you pass any datasource to SFGrid and than try to pass different datasource to that. You will notice it doesn't refresh the schema of grid as per the passed datasource. In that case we have to do this

@if (RenderGridData) 
{ 
    <SfGrid 
    @ref="gridObj" 
    Height="400px" 
    Width="100%" 
    TValue="ExpandoObject" 
    DataSource=@data> 
    </SfGrid> 
} 
 
    public bool RenderGridData= true; 
    public async Task OnGenerateNewData() 
    { 
        RenderGridData= false; 
        await Task.Yield(); 
        this.data = RandomDataSource(); 
        RenderGridData= true; /*Set True after changing the datasource*/
}

As you can see , we have to keep the component inside a bool variable and than we have to set the value to false before changing the datasource and than put it back to true after the datasource is changed. Now , run the application and you will see your grid component will refresh as per the passed datasource.

So, this is how you can solve the issue Changing sfgrid datasource does not work in Blazor.

S
Shubham Batra
Programming author at Code2Night โ€” sharing tutorials on ASP.NET, C#, and more.
View all posts โ†’

Related Articles

Mastering Async and Await in C#: A Comprehensive Guide
Mar 16, 2026
Understanding Memory Management and Garbage Collection in .NET
Mar 16, 2026
Understanding Records and Pattern Matching in C# 9 and Above
Mar 16, 2026
Understanding Extension Methods in C#: Enhancing Your Code with Ease
Mar 16, 2026

Comments

Tags

AspNet
C#
programming
AspNet MVC
c programming
AspNet Core
C
software development
tutorial
MVC
memory management
Paypal
coding
coding best practices
data structures
programming tutorial
tutorials
object oriented programming
Slick Slider
StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blogs
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
Free Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Diff Checker
  • Base64 Encode/Decode
  • Word Counter
By Language
  • Angular
  • C
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ยท  Terms
Translate Page