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

Is this scenario possible? - Selective use of Ajax

2 Answers 23 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 21 May 2014, 01:44 PM
I have a RadComboBox and other controls, including an ASP Repeater within a RadAjaxPanel.  
The contents of the combo box are fairly typical, a list of numbers with -1 and blank text indicating that nothing has been selected.
The repeater displays a list of bound RadButton check boxes.

If the combo box has a valid value (> 0) selected, the server-side selected index changed event of the combo box calls a routine to repopulate the repeater, 

If the combo box is set to -1 what I would like to happen is for the post back to be canceled and the most recent collection of controls in the repeater (and their checked values) to be retained, and the combo box itself to retain its -1 value.

Is this possible?

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 22 May 2014, 06:47 AM
Hi Boris,

Please try to attach the OnClientSelectedIndexChanging event of RadComboBox and based on the selected item text cancel the event so that the server side event will not execute. Please have a look into the below JavaScript code snippet.

JavaScript:
function SelectionChange(sender, args) {
    if (args.get_item().get_text() == -1) {
        args.set_cancel(true);
        sender.set_text("-1");
    }
}

Let me know if you have any concern.
Thanks,
Shinu.
0
Boris
Top achievements
Rank 1
answered on 30 May 2014, 06:06 PM
Actually they just changed the requirements so I can't try this, but I'll keep it in mind for future use.  

Thanks.
Tags
Ajax
Asked by
Boris
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Boris
Top achievements
Rank 1
Share this question
or