vb.net - Accessing RadListBox Items in Code-Behind -
i have following radlistbox:
<telerik:radlistbox id="attachmentsradlistbox" checkboxes ="true" runat="server" />
it located in radwindow, therefore populating through following code called when radwidnow becomes visible:
attachmentsradlistbox.datasource = attachdt attachmentsradlistbox.datatextfield = "documentpath" attachmentsradlistbox.datavaluefield = "documentid" attachmentsradlistbox.databind() each item radlistboxitem in attachmentsradlistbox.items item.checked = true next
so far good, radlistbox populated , items checked.
now, there save button on radwindow when pressed before closing window trying read checked items in attachmentsradlistbox (since user might have changed status of checked items). every effort on reading items has failed, example on save button click have following:
dim test integer = attachmentsradlistbox.items.count // 0 each item radlistboxitem in attachmentsradlistbox.items // there no items if not item.checked dim documentidtodelete integer = item.value end if next
why last piece of code not behave hope? attachmentsradlistbox not being bounded again through postback. time bounded when radwindow appears. save button on radwindow creates postback don't understand why attachmentsradlistbox contains no item @ point.
since create attachmentsradlistbox dynamically, recreate on subsequent postbacks? is, in end, server control, need make sure recreated, because otherwise asp destroy upon subsequent postback. see how can access controls in contenttemplate of radwindow can examine article: http://www.telerik.com/help/aspnet-ajax/window-controls-container.html.
Comments
Post a Comment