Display comma separated values in grid from controller in mvc

1 Answer 1056 Views
MultiSelect
froger
Top achievements
Rank 1
Iron
froger asked on 01 Oct 2021, 05:28 AM | edited on 01 Oct 2021, 05:31 AM

Hi,

I have one table

 

Employee

..............

EId   EName      CompanyId's

1        a              1,2

2        b               2


                @(Html.Kendo().Grid<Emplopyee>
    ()
    .Name("grid")
    .Columns(columns =>
    {
        columns.ForeignKey(f => f.CompanyId,
        (System.Collections.IEnumerable)ViewData["CompaniesList"],
        "CompanyId", "CompanyName")
        .EditorTemplateName("CompaniesEditor").Title("Company Name").Width(200)    

        columns.Bound(p => p.EId).Filterable(false);        
columns.Bound(p => p.EName);
        
    })
     
    .Pageable()
    .Sortable()
    
    .Filterable()
    .HtmlAttributes(new { style = "height:550px;" })
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(20)
    .Read(read => read.Action("GetDetails", "Home"))
    .Model(model => model.Id(p => p.EId))

    )
    )

CompaniesEditor
.......................

(
                 Html.Kendo().MultiSelectFor(m => m)
                        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"]).Filter(FilterType.Contains).TagTemplateId("tagTemplate") // Reference to the template.
    )

2

 

my requirement is that need to display comma separated values in grid

 

can any one help me

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 05 Oct 2021, 10:00 AM

Hi Mahesh,

 

Thank you for writing to us.

You can achieve this requirement by using a javascript function inside the Grid Column Template:
https://docs.telerik.com/aspnet-mvc/html-helpers/data-management/grid/faq#how-can-i-use-javascript-functions-in-client-column-templates

Feel free to check this approach and let me know if it helps you.

If you provide me more details, I can also prepare a new MVC sample and send it to you.

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

froger
Top achievements
Rank 1
Iron
commented on 05 Oct 2021, 12:32 PM

Hi,

I have 2 tables

 

Employee

...................

EId     EName

1             a

2           b

3          c

 

Attachments

.................................

AttachmentId    Attachment Name    EId

1                          C:Emps/abc.pdf        1

2                          C:Emps/edy.word         1

3                          c:Emps/2282.jph            2

 

Currently my requirement is that i am going to implement file upload conttrol in mvc column grid

 

ex:For each row i may upload multiple files

like that i am going to do it for multiple rows

i need sample project related to my requirement

 

for your reference i have provided sample data

 

can you please help me

 

 

 

Eyup
Telerik team
commented on 08 Oct 2021, 10:33 AM

Thank you for providing additional details.

However, I noticed that this account doesn't have any legitimate license assigned. Can you contact your Company License Representative and ensure that he/she assigns you a valid Telerik license? Feel free to contact Telerik Sales Department for any inquiries.

Then, we can proceed with resolving the technical question.

Tags
MultiSelect
Asked by
froger
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Share this question
or