This is a migrated thread and some comments may be shown as answers.

How to retrieve Items server side after postback

2 Answers 113 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 30 May 2012, 09:52 PM
I'm using the RadListbox to edit a list of data client side, but need to retrieve the list on postback on the server.

From the server side I populate the list using the Items property. The list display well client side and using javascript I can reorder the list, add item and remove item.

Since the list is modified client side, i need to retrieve the modified list on the server. But I haven't found a way to do this. The Items property of the RadListBox is alway empty after the postback. How can I achieve this with the RadListBox? Is this something possible or should I add my own hidden control to keep track of everything?

thank you

2 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 31 May 2012, 03:17 PM
Hello Simon,

In order to preserve the changes made on the client, the trackChanges and commitChanges methods should be used. Please refer to the following help article here under the Preserving changes section.

Kind regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Simon
Top achievements
Rank 1
answered on 31 May 2012, 06:28 PM
Hello,

Using the example found in this thread : http://www.telerik.com/community/forums/aspnet-ajax/listbox/reading-dynamically-added-data-on-postback.aspx.

I was able to have what I wanted. I use the RadListBox in a custom control that is after added in a page. The example was about the radListBox aded directly in the page. So I create the most simple custom control with only one RadLIstBox inside and one property to expose the RadListBox and it was not working.

The problem was that the RadListBox was added in the CreateChildControl function. When I move the creation and the add in the constructor everything start working. The list modified client-side is now available using the Items property in the button event (After postback).
Tags
ListBox
Asked by
Simon
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Simon
Top achievements
Rank 1
Share this question
or