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 get back the selections of 'multiselect' with checkboxes

Hi

first of all the documentation link for dropdown List/Getting Started is 'page not found'

My dropdownlist is like
 <ej-drop-down-list id="id1"  ej-for="strBands" datasource=@Model.Bands show-checkbox="true" width="100%" watermark-text="Select the bands you need">
                                <e-drop-down-list-fields selected=@Model.strBands  id="dxid" text="display" value="value" />
                            </ej-drop-down-list>

strBands is a string and returns only the first selection.

Model.Bands in controller is
  public class BANDS
        {
            public BANDS ini(string strdisp, string strval)
            {
                display = strdisp;
                value = strval;
                return this;
            }
            public string display { get; set; }
            public string value { get; set; }
        }

Thank you in advance for the help
Geirge

5 Replies

KV Karthikeyan Viswanathan Syncfusion Team December 2, 2016 12:52 PM UTC

Hi George, 
  
 Thanks for contacting syncfusion support. 
Sorry for this inconvenience caused. We have refresh the online documentation for dropdownlist. Please refer the link: https://help.syncfusion.com/aspnet-core/dropdownlist/getting-started 
 You can pass a value field data into ej-for.  For an example : You have display & value property data. You can pass a value property data into strBands.It will be set at initial time. We have prepared a sample based on your requirement. 
Please refer the sample link:  
Regards, 
Karthikeyan V. 



GR George Rossopoulos December 2, 2016 06:04 PM UTC

Hi Karthikeyan

thank you for your prompt reply. The problem i have is that this dropdown is in a form when the form submit then the strBands string has only the first selected item of the dropdown which is multiselect and the user may select even all its items.
In other words i want to have in the controller all the text that the dropdown displays e.g (as per your example) "Audi S6,Austin-žHealey,Ferrari š360"

thank you

George


KV Karthikeyan Viswanathan Syncfusion Team December 5, 2016 08:22 AM UTC

Hi George,  
   
 Thanks for your response.  
Query: when the form submit then the strBands string has only the first selected item of the dropdown in multiselection. 
 
When multiselection the DropDownList returns collection of list data into form post method. You can retrieve the selected data using List<datatype> and model name. Please refer the below code snippet: 
 
<code> 
public IActionResult Index(List<string> strBands) 
        { 
            .... 
       } 
</code> 
 
 
Refer the sample link:  sample  
 
Regards,  
Karthikeyan V.  



GR George Rossopoulos December 5, 2016 03:29 PM UTC

Hi Karthikeyan 

Thank you!!!! Worked Ok now.
You should add this in the (poor) 'asp.net code' documentation.

Thank you
George


KV Karthikeyan Viswanathan Syncfusion Team December 6, 2016 05:54 AM UTC

Hi George, 
Thanks for the update. 
We are glad the suggestion helped you to achieve your requirement. Sorry for this lack of information in help documentation. We consider your request.
Please let us know if you need further assistance. 
Regards,  
Karthikeyan V.


Loader.
Live Chat Icon For mobile
Up arrow icon