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

ListBox - Back End - Remote

please give me an example of back end remote using saveChanges from list box


back end in asp.net


3 Replies

AD Arunkumar Devendiran Syncfusion Team November 14, 2019 05:29 PM UTC

Hi Roberto, 
 
Thank you for contacting Syncfusion support. 
 
We need to validate on this query, and we will update you with further details on November 18, 2019. 
 
Regards, 
Arunkumar D 



RO roberto November 20, 2019 04:47 PM UTC

waiting


AD Arunkumar Devendiran Syncfusion Team November 21, 2019 07:59 PM UTC

Hi Roberto,  
  
Sorry for the inconvenience. 
 
We have created sample for your requirement, in that sample we get the listbox data from the server side using ajax ‘GET’ method and this data assigned to the listbox datasource. You can add the new list item ( Volley Ball) and this new item is added in the server side using ajax ‘POST’ method. Please refer the below code snippet and sample link.  
 
Html 
 
        document.getElementById('load').addEventListener("click", function () { 
            $.ajax({ 
                async: false, 
                url: 'https://localhost:44303/api/values', 
                type: 'GET', 
                dataType: 'json', 
                success: function (data) { 
                    listObj.dataSource = data.Value; 
                    listObj.dataBind(); 
                } 
            }); 
        }); 
        document.getElementById('add').addEventListener("click", function () { 
            listObj.addItems({ Id: 'game10', Name: 'Volley Ball' }) 
            var postData = JSON.stringify({ Id: 'game10', Name: 'Volley Ball' }); 
            $.ajax({ 
                async: false, 
                url: 'https://localhost:44303/api/values', 
                type: 'POST', 
                dataType: 'json', 
                data: { jsonData: postData }, 
                success: function (data) { 
                    return data; 
                } 
            }); 
        }); 
 
 
Controller 
 
public static List<game> Games = new List<game> { 
            new game { Id = "game0", Name = "Badminton" }, 
            new game { Id = "game1", Name = "Cricket" }, 
            new game { Id = "game2", Name = "Football" }, 
            new game { Id = "game3", Name = "Golf" }, 
            new game { Id = "game4", Name = "Tennis" }, 
            new game { Id = "game5", Name = "Basket Ball" }, 
            new game { Id = "game6", Name = "Base Ball" }, 
            new game { Id = "game7", Name = "Hockey" } 
        }; 
 
        public JsonResult Get() 
        { 
            return new JsonResult(Games); 
        } 
 
       public void Post() 
        { 
            string jsonData = HttpContext.Current.Request.Params["jsonData"]; 
            game game1 = new JavaScriptSerializer().Deserialize<game>(jsonData); 
            Games.Add(game1); 
        } 
 
 
Sample Link: 
 
Could you please check the above link and get back to us with more information if we misunderstood your requirement or need further assistance. 
 
Regards, 
Arunkumar D 


Loader.
Live Chat Icon For mobile
Up arrow icon