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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ListBox - Back End - Remote

Thread ID:

Created:

Updated:

Platform:

Replies:

149071 Nov 13,2019 11:32 AM UTC Nov 21,2019 07:59 PM UTC JavaScript - EJ 2 3
loading
Tags: ListBox
roberto
Asked On November 13, 2019 04:35 PM UTC

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


back end in asp.net


Arunkumar Devendiran [Syncfusion]
Replied On 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 


roberto
Replied On November 20, 2019 04:47 PM UTC

waiting

Arunkumar Devendiran [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon