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

Populate dropdownlist from server ViewBag

Hi Guys,Could you create a grid example that has data-type DropdownList that is populated from (datasource ViewBag) uses a table in EF code firstRegards Edmund Herbert

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team August 2, 2017 01:15 PM UTC

Hi Edmund, 

Thanks for contacting Syncfusion support. 

We have understood from your query, you want to display the Dropdown while editing the grid. Then we suggest you to refer the following Help documentation and online demo for your reference, 

You may also give a data source from in viewbag  for Dropdown list in columns data source property. Please refer to the following code example, 
Code example
<ej-grid id="FlatGrid" allow-paging="true" allow-filtering="true" create="onCreated"> 
    <e-filter-settings filter-type="Menu" /> 
    <e-datamanager json="ViewBag.child" /> 
    
    <e-edit-settings allow-deleting="true" allow-editing="true" allow-adding="true" edit-mode="@(EditMode.Dialog)" /> 
    <e-toolbar-settings show-toolbar="true" toolbar-items="@(new List<string>() {"add","edit","delete","update","cancel" })"></e-toolbar-settings> 
    <e-columns> 
         
        <e-column field="OrderID" is-primary-key="true" header-text="OrderID" width="90"></e-column> 
        <e-column field="CustomerID" header-text="Customer ID" width="80"></e-column> 
        <e-column field="EmployeeID" header-text="Employee Id" edit-type="Dropdown" datasource="ViewBag.dropdown"></e-column> 
        <e-column field="ShipCountry" header-text="Ship Country" width="110"></e-column> 
    </e-columns> 
</ej-grid> 
 

Note: Dropdown data source should be text and value pair. Please refer to the following Help documentation for more information, 


If we misunderstood your requirement, then could you please provide more details about your requirement and scenario, Grid code example? 

Regards, 
Venkatesh Ayothiraman. 



EH Edmund Herbert August 2, 2017 01:26 PM UTC

Thanks for your help



VA Venkatesh Ayothi Raman Syncfusion Team August 3, 2017 04:13 AM UTC

Hi Edmund, 
Thanks for the update. 

We are very happy to hear that your requirement is achieved. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Live Chat Icon For mobile
Up arrow icon