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

Rename Listbox Item client-side

3 Answers 98 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Roby Kaufman
Top achievements
Rank 1
Roby Kaufman asked on 10 Dec 2009, 10:40 PM

Version: RadControls for ASP.NET AJAX 2009 Q3 (1208)

I have been unable to refresh a listbox after renaming an item using the following code.  I have also attempted using the listbox track/commit functions pre/post rename to no avail.

var listbox = $find("<%= MyListBox.ClientID %>");         
var selectedItem = listbox.get_selectedItem();  
if (selectedItem) {  
 selectedItem.set_text("New Name");  
 listbox.repaint();  

Please suggest the correct method for renaming a listbox item so that it may be visible to the end user.

Thanks,
Karlin

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 11 Dec 2009, 01:00 PM
Hi Karlin,

I've tested this code and it worked at our side. Could you please open a support ticket and send us a simple page illustrating the problem. Thanks


Kind regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Roby Kaufman
Top achievements
Rank 1
answered on 11 Dec 2009, 08:33 PM
Ok, I've submitted a support ticket.  I need to further clarify my situation.  I am unable to rename an item that has been moved from another listbox via the listbox to listbox transfer functionality.
0
Roby Kaufman
Top achievements
Rank 1
answered on 14 Dec 2009, 04:37 PM

If anyone else is having the same issue, here is the current workaround from Telerik support:

if (selectedItem) {  
                selectedItem._textElement =   
                    $telerik.$(selectedItem.get_element()).children("span")[0];  
                selectedItem.set_text('new text');  
            }  
 

I'm told this should be fixed in the next release.
Tags
ListBox
Asked by
Roby Kaufman
Top achievements
Rank 1
Answers by
Yana
Telerik team
Roby Kaufman
Top achievements
Rank 1
Share this question
or