Disabled listbox - set selected item

3 posts, 0 answers
  1. Pieter
    Pieter avatar
    9 posts
    Member since:
    Dec 2006

    Posted 19 Mar 2010 Link to this post

    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. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 22 Mar 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pieter
    Pieter avatar
    9 posts
    Member since:
    Dec 2006

    Posted 25 Mar 2010 Link to this post

    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.
Back to Top