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

set_checked(true) not saving after postback

2 Answers 70 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
yoomee kwon
Top achievements
Rank 1
yoomee kwon asked on 12 Nov 2009, 05:10 PM
I have the checkbox items in the listbox.
When the item is inserted into the  listbox, I want the checkbox to be automatically checked to be true.
However during the postback, the checked value is false on the serverside. How can I retrieve the value set by the client side?

Here is my code.

<

 

script language="javascript" type="text/javascript">

 

 

function AddItems(strDay, strDate, strType1, strType2) {

 

 

var list = $find("<%= lstDFSummary.ClientID %>");

 

 

var items = list.get_items();

 

list.trackChanges();

 

var item = new Telerik.Web.UI.RadListBoxItem();

 

 

var item2 = new Telerik.Web.UI.RadListBoxItem();

 

item.set_text(strDay + " , " + strDate + " - " + strType1 + " " + "<%= strShowName %>");

 

item.set_checked(

true);

 

items.add(item);

 

 

 

 

list.commitChanges();

}

 

</

 

script>

 

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Nov 2009, 02:35 PM
Hello Yoomee,

I suggest you first add the item to the items collection of RadListBox and then set its checked state:

items.add(item);
item.set_checked(true);


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
yoomee kwon
Top achievements
Rank 1
answered on 17 Nov 2009, 04:49 PM
Great , it worked!
Tags
ListBox
Asked by
yoomee kwon
Top achievements
Rank 1
Answers by
Yana
Telerik team
yoomee kwon
Top achievements
Rank 1
Share this question
or