We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to create grid programmatically

I want to create complete Datagrid programatically.  Each functionality should be done using C# like

  1. Grid Creation
  2. Column creation with specific type and datasource in case of dropdown list
  3. linking of datasource
  4. sorting, grouping filtering, use of aggrgation functions, validations.
  5. New row add, edit with grid events, deleting and many more.
In short, which are functionality provided in Tags should be done through c# code.


I dont want to use any HTML/Razor tag for that.

My further development is to create all the input elements programmatically. 

So please guide me with sample code. 


3 Replies

MS Monisha Saravanan Syncfusion Team May 2, 2023 07:48 AM UTC

Hi Amish,


Greetings from Syncfusion support.


We have prepared an simple sample based on your requirement. Kindly check the attached sample for additional information.


Please get back to us if you have further queries.


Regards,

Monisha


Attachment: SyncfusionBlazorApp13_9804d713_(1)_fb69b371.zip


AM Amish replied to Monisha Saravanan May 2, 2023 08:56 AM UTC

You have done great work.


Madam, my main question is that I dont want to use any HTML Tags. I just want to create complete grid with mentioned functionalities using c# code using

builder.OpenComponent(0,typeof(SfTextBox));

        builder.AddAttribute(11, "Name", "JStxt");

        builder.CloseComponent();


.



MS Monisha Saravanan Syncfusion Team May 3, 2023 04:53 AM UTC

Hi Amish,


Sorry for the inconvenience caused. Please find the attached sample here we have created entire DataGrid using RenderTreeBuilder concept. Kindly check the attached sample for your reference and get back to us if you have further queries.


Regards,

Monisha


Attachment: BlazorApp10_4(1)_d9d48e06.zip

Loader.
Up arrow icon