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

Clear Selection in Javascript and postback.

2 Answers 167 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fergal
Top achievements
Rank 1
Fergal asked on 10 Dec 2013, 02:18 PM
I'm trying to Clear a RadComboBox in javascript, and have it post back (when AutoPostBack is enabled). I've been searching around for a solution, and this is the best I can come up with - but it feels incredibly hacky - is there a more appropriate method of doing this?

var combo = $find(comboId);
combo.hideDropDown();
combo.trackChanges();
combo.clearSelection();
combo.commitChanges();
var f = { Command: "Select", Index: combo.get_selectedIndex() };
combo.postback(f);

Thanks
Fergal

2 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 13 Dec 2013, 09:37 AM
Hello Fergal,

Regarding the clearing of the RadComboBox, the used approach is the correct one. As for having the RadComboBox to artificially fire a postback, this is however consider as a hack, therefore, it is possible to pally the custom approach you are currently using.

Regards,
Nencho
Telerik
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 the blog feed now.
0
Fergal
Top achievements
Rank 1
answered on 13 Dec 2013, 11:20 AM
Thanks Nencho, I'll keep using that for now then.
Tags
ComboBox
Asked by
Fergal
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Fergal
Top achievements
Rank 1
Share this question
or