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

Disabled listbox - set selected item

2 Answers 136 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Pieter
Top achievements
Rank 1
Pieter asked on 19 Mar 2010, 08:47 AM
Hello,
In the codebehind we disabled the ComboBox and set a selected item. Via JavaScript we want to change the selected item via:
function winDialogCallbackControleren(radWindow, returnValue) {  
  if (returnValue != "-1") {  
    var combobox = $find("<%=rcbDocumentStatus.ClientID %>");  
    var item = combobox.findItemByValue(returnValue);  
    if (item) {  
      item.select();  
    }  
  }  
But it didn't succeed. The already selected item (from the codebehind) remains unchanged. What are we doing wrong?
With friendly greetings,
Pieter
From The Netherlands

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 22 Mar 2010, 03:40 PM
I'm not sure if you have do enable the control first and then re-disable it, but I do know that in order to persist the item to the server you have to call trackChanges() before your logic and commitChanges() afterward. You can see an example of this and more information regarding the client-side aspect of the RadListBox by following this link to a documentation article.
0
Pieter
Top achievements
Rank 1
answered on 25 Mar 2010, 08:54 AM
function winDialogCallbackControleren(radWindow, returnValue) {     
  if (returnValue != "-1") {     
    var combobox = $find("<%=rcbDocumentStatus.ClientID %>");     
    if (combobox) {     
       combobox.enable();     
       var item = combobox.findItemByValue(returnValue);     
       if (item) {     
         item.select();     
       }     
       combobox.disable();     
    }     
  }     
  else {     
  }     
}    
 
This is the solution.
Tags
ListBox
Asked by
Pieter
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Pieter
Top achievements
Rank 1
Share this question
or