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

Disable Autopostback after client script change

3 Answers 192 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jason Brunken
Top achievements
Rank 1
Jason Brunken asked on 17 Nov 2008, 09:11 PM
I have an instance of RadComboBox set to do autopostback, but I would like to be able to change the value of the selected item through javascript without forcing an autopostback on the client or triggering a "Selected Item Changed" event on the server at the next postback.

Is there any good way to accomplish this?

Thanks

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Nov 2008, 12:12 PM
Hi Jason,

You can change the value of ComboBox item by using "set_value" method. Please use the JavaScript below.

JavaScript:
function changevalue()  
{  
    var combo = $find("<%= RadComboBox1.ClientID %>");  
    combo.set_value("New Value");   //setting the value  
    combo.commitChanges();          
    var temp=combo.get_value();     //accessing the value  
    alert("New value for selected item: "+temp);  

Thanks,
Princy.
0
Jason Brunken
Top achievements
Rank 1
answered on 18 Nov 2008, 03:22 PM
Unfortunately this does not work for me.   I need to be able to change the selected index without triggering an autopostback.

Thanks

0
Simon
Telerik team
answered on 20 Nov 2008, 06:35 PM
Hi Jason Brunken,

You could set the AutoPostBack property of the ComboBox to false to disable the immediate postbacks done on certain client-side events (chaning the selected index for instance).

Please reconsider your requirements.

All the best,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Jason Brunken
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jason Brunken
Top achievements
Rank 1
Simon
Telerik team
Share this question
or