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

TagHelper syntax for local datasource with List<Object> in ViewBag.

     I'm trying to get a Grid working with a List<MyObject> contained in ViewBag.txns.

What is the Razor syntax for a local datasource like this, using TagHelpers? I've tried below but it doesn't work:

        <ej-grid id="FlatGrid" datasource="ViewBag.txns">
            <e-columns>
                <e-column field="TransactionDate" header-text="Date" text-align="Left" width="70" format="{0:MM/dd/yyyy}"></e-column>
                <e-column field="Reference1" header-text="Reference" width="80"></e-column>
                <e-column field="Balance" header-text="Balance" text-align="Right" width="75"></e-column>
            </e-columns>
        </ej-grid>

Thanks

3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team April 4, 2017 08:51 AM UTC

Hi Alan,  
 
Thanks for contacting Syncfusion support.  
 
We are unable to reproduce any problem with the given code snippet. The format given in your code example for binding datasource to the Grid is correct and we are not finding any error with this code example.  
 
<ej-grid id="FlatGrid" allow-sorting="true" datasource="ViewBag.parent" allow-paging="true"> 
 
    <e-columns> 
        <e-column field="EmployeeID" header-text="Employee ID"  width="75"></e-column> 
        <e-column field="FirstName" header-text="First Name" width="80"></e-column> 
        <e-column field="LastName" header-text="Last Name" visible="false" width="75"></e-column> 
    </e-columns> 
</ej-grid> 
 
We have prepared a sample that can be downloaded from the following location. 
 
 
Please share the following details to analyze the problem at our end.  
 
1)      Code example of the code behind 
2)      Screenshot for the issue 
3)      Version of the Essential Studio 
4)      If possible, modify the attached sample and reproduce the issue 
 
Regards,  
Seeni Sakthi Kumar S. 



AB Alan Bourke April 4, 2017 10:14 AM UTC

Thanks the sample works fine, the problem was something else in the end. FWIW ViewBag.whatever without quotes also works.






SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team April 5, 2017 05:27 AM UTC

Hi Customer,  
 
Thanks for the update. 
 
We are happy to hear that your requirement has been resolved. Please get back to us, if you require further assistance on this. 
 
Regards,  
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon