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

Handling RadListBox checkbox ItemChecked

1 Answer 116 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Cameron
Top achievements
Rank 1
Cameron asked on 31 Jul 2012, 10:19 AM
I have a RadListbox with CheckBoxes set to true. What I'm doing is reading data in to the listbox from a sql database and having the checkbox be checked if the data is able to be crossreferenced with another table. 

I am able to populate the listbox with data and have the checkboxes be checked or unchecked on page load. My problem is handing the ItemChecked event. I want to capture the event and pass the value of the list item that had it's check box checked or unchecked to a function in server side code. The function then either creates or deletes a record in my sql database for cross referencing.

For example I have a 4 items in the list, the items consist of a name and a value(a guid), items 1 and 3 are checked on load. When I check item 2 how do I capture the check event and then pass the GUID value to the code?

I attempted to follow the instructions listed here: http://www.telerik.com/help/aspnet-ajax/ajax-client-side-api.html but I had no luck in getting it to call the function much less figuring out how to pass the information I need in the arguments.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 03 Aug 2012, 07:59 AM
Hi Cameron,

You could handle the ListBox OnClientItemChecked event and raised an ajaxRequest as shown  in the help topic. In the ajaxRequest you could pass the checked item as an argument and based on this argument in the server AjaxRequest event proceed with the needed db logic.
Please note that all the controls that will be updated on this ajax request would be added as updated control in the RadAjaxManager with the RadAjaxManager as ajax initiator.

Kind regards,
Maria Ilieva
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.
Tags
Ajax
Asked by
Cameron
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or