Dynamic columns/data source - Remote/SQL
I wish to create an sfdatagrid with SQL data sources, the TValue/record type is unknown, this is totally dynamic, much like the MS SQL Query manager... I need filtering/sorting/paging - like odata/graphql
I have seen that SfDataManager can proxy to odata/graphql/etc but requires a known TValue - so I can't use that.
What are my options?
Thanks!
Hi Doug Sellner,
Greetings from Syncfusion,
Based on your query, we understand that you are looking to create a DataGrid with an SQL DataSource without defining the TValue of the grid, using an OData adaptor by generating dynamic columns. To address this, we have implemented a DataGrid that meets these requirements by configuring it with an SQL DataSource without specifying TValue, enabling dynamic column generation using ExpandoObject binding, and incorporating the requested features such as paging, filtering, and sorting. Please check the attached file for detailed implementation steps and examples, and feel free to reach out if you have any further questions or need additional assistance.
Sample: Attached.
Video Demo: Attached.
Additional References:
https://blazor.syncfusion.com/documentation/datagrid/connecting-to-adaptors/odatav4-adaptor
https://blazor.syncfusion.com/documentation/datagrid/data-binding/local-data#expandoobject-binding
Note: While deploying the application, we request you to create the SQL table on your side and update the connection string inside the AppSettings.json file in the ODataServiceProject solution.
Regards,
Sanjay Kumar Suresh
Attachment: SampleAndVideoDemo_844d5bd1.zip
Thanks, I was really hoping NOT to provide an odata or graphql endpoint, and NO C#/POC/Entities as your example did. Hoping to just use SQL (without pre known POC/Entity classes). I see that 1) URL Adapter; 2) ODataV4, 3) Web API, 4) Custom; 5) GraphQL are supported as "Connecting to Adapters" and I'm surprised there is no SQL option. (Seems all your stuff relies upon Entity Framework...)
Caveat - I could re-expose the data to odata/graphql but I haven't suitable nuget that doesn't require pre-known entities - if this is my only option do you have recommendations? (I have found sstand alone apps - that would be more complex)
Your sample code provided did specify a TValue for the grid tho, and did have pre-defined POCs.
Seems that the "Custom Adaptor" might be my only hope, I will look into reverse engineering that to work with SQL/ODBC...
Other suggestions?
I resolved my issue:
- While SfGrid does require a TValue, that can be "object"
- <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
- public override object Read - can return a DataResult { Result = my custom query results}
- DataManagerRequest must be parsed to sql which is fine....
Hi Doug Sellner,
We are glad to hear that the reported issue resolved at your end.
Please
get back to us if you need any further assistance. We will be happy to assist
you.
Regards,
Naveen
- 4 Replies
- 3 Participants
-
DS Doug Sellner
- Jan 21, 2026 02:55 AM UTC
- Jan 22, 2026 06:36 AM UTC