Providing default values to Dynamic Columns

2 posts, 0 answers
  1. Mudit
    Mudit avatar
    5 posts
    Member since:
    Mar 2020

    Posted 08 Jun 2020 Link to this post

         Hi

     

    We are trying to create a grid which will have columns added dynamically. Once the grid is bound properly it complaints about not having a default value to the dynamic columns. How can we provide a dynamic columns with default values.

     

    Also we did initialize these values in model constructor, logically those should have been picked up but somehow grid wants explicit default values for all columns.

     

    Regards

    M.

  2. Neli
    Admin
    Neli avatar
    428 posts

    Posted 10 Jun 2020 Link to this post

    Hi Mudit,

     

    I would suggest you take a look at the following sample project where dynamic Grid is created.

    - https://github.com/telerik/ui-for-aspnet-mvc-examples/blob/master/grid/binding-to-datatable/KendoUIMVC5/Views/Home/Index.cshtml

    When the Grid is created dynamically, you could return the Model to the view and iterate through its properties and their type. This way you could configure the DataSource Model and set the type of the fields. Also, if needed, you could set DefaultValue, by using the DefaultValue method

    I hope the provided sample project will help. In case the issue continues to persist may I ask you to prepare a small isolated sample where the issue can be observed and send it back to us? This will help us to troubleshoot locally and provide you with further assistance. 

    In case you have additional questions do not hesitate to contact us.

     

    Regards,
    Neli
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top