Code2night
  • Home
  • Blogs
  • Tutorial
  • Post Blog
  • Tools
    • Json Beautifier
    • Html Beautifier
  • Members
    • Register
    • Login
  1. Home
  2. Blogpost
11 Jun
2022

Changing sfgrid datasource does not work in Blazor

by Shubham Batra

1254


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.

  • |
  • Blazor , Syncfusion , SFGrid , Syncfusion SFgrid , Net , C# , Net core 60

Comments

Follow Us On Social Media - Like Us On Facebook

Best Sellers

product 1

Hand Hug Bracelet For Women Men Cuff Bangle Adjustable Lover Couple Bracelets

Can be given as a gift to your family, relatives, or friends

Buy $15.99
product 1

Teddy bear hug bear plush toy bear cub

Can be given as a gift to your family, relatives, or friends


Buy $49.99

Tags

LinkedinLogin
LinkedinProfile
GetLinkedinProfile
C#
Aspnet
MVC
Linkedin
ITextSharp
Export to Pdf
AspNet Core
AspNet
View to Pdf in Aspnet
Model Validation In ASPNET Core MVC 60
Model Validation
Model Validation In ASPNET Core MVC
Model Validation In ASPNET
Image Compression in AspNet
Compress Image in c#
AspNet MVC
Thank you for Downloading....!

Subscribe for more tutorials

Support our team

Continue with Downloading

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Panipat
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2023 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Terms & Conditions
  • Refund Policy
  • About Us
  • Privacy Policy
  • Json Beautifier