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

undefined data("ejListBox")

Hi. 

I use visual studio 2017 community and Essential Studio Enterprise Edition - Community license version 15.2.0.40
I have a problem with ListBox, and other controls like Grid. this is my case: 

I created 2 projects with template "Syncfusion ASP.NET MVC Application", in project1 only choose the control ListBox



and project2 choose all controls in Navigation content



in both project add in HomeController this code



in both View About.cshtml add this code



when run the projects in project2(project where choose all controls in item navigation) work fine, when click in guardar button




but when I run project1(only choose control ListBox), I am get this issue



this is because the target is undefined.

I check all projects folder by folder, and they have the same files.

please give me some directions on how to fix this. In other control (Grid) i am get the same issue when use ejGrid, it could be the same error

thanks and good day.

3 Replies

AP Arun Palaniyandi Syncfusion Team June 30, 2017 12:44 PM UTC

Hi Johanny Valencia, 
 
Thanks for contacting Syncfusion Support.    
 
   
We have checked the reported issue and able to reproduce it. While analyzing the shared screenshot, we have found, that the issue is due an ID of the ListBox. We could see the different ListBox ID in the button click event which is technically invalid and hence the object is not created for that ID. Therefore, this throws the console error.   
 


 
             @Html.EJ().ListBox("listboxsample").Width("240").Datasource((IEnumerable<SyncfusionMvcApplication.ListBoxController.skillset>)ViewBag.datasource).ShowCheckbox(true).ListBoxFields(df => 
     df.Text("text")) 
 
<script> 
 
    $("#Guardarstriker").on("click", function () { 
 
        target = $("#listboxsample").data("ejListBox"); // in your screenshot you have given id as #Areas 
        var checkedItems = target.getCheckedItems(); 
    }) 
 
 
</script>     



 
Please find the sample below for reference: 
 
 
Also, we would like to confirm the below details.   
 
·         Whether you are facing this issue even when the id is correct? 
·         Whether you are facing this issue only when the ListBox is created with the sample creator or normally? 
·         As you mentioned in ejGrid also you are getting the same error. So, is it the same issue problem over there? 
 
 
Please check the shared sample, information and if the shared details still doesn’t meet your requirement, please send us the asked information, so that we will provide a solution.         
         
Regards,         
Arun P.     



JV Johanny Valencia Sanchez July 1, 2017 08:45 AM UTC

Thank you, for you response Arun.

It was a beginner error. I did the same correction as the image that you sent me and it worked.

With ejGrid put in comment the line @Scripts.Render("~/bundles/jquery/js") in the _Layout.cshtml and it worked


Thank you for your help. have a nice weekend




AP Arun Palaniyandi Syncfusion Team July 3, 2017 11:42 AM UTC

Hi  Johanny Valencia, 

We are glad that your issue has been resolved. 

Please let us know if you have any queries in future. 

Regards, 
Arun P. 


Loader.
Live Chat Icon For mobile
Up arrow icon