I think I followed all the rules to transfer data between two listboxes but I am getting empty text when transferring from one list box to another...
This is the aspx file
This is the cs file
After transferring an empty text is transferred... see attachment. What am I doing wrong?
This is the aspx file
<Telerik:RadListListBox id="lstAvailable" runat="server" allowtransfer="true" transfertoid="lstAllocated" width="350px" height="240px" autopostbackontransfer="true" selectionmode="Multiple"> <HeaderTemplate> <div style="text-align: center; background-color: #EEE;"> <asp:Label ID="lblAvailable" runat="server" Text="Available fields"></asp:Label> </div> </HeaderTemplate> <ItemTemplate> <div style="width:auto"> <%#Eval("Text") %> </div> </ItemTemplate><Telerik:RadListListBox><Telerik:RadListListBox id="lstAllocated" runat="server" selectionmode="Multiple" allowdelete="False" width="350px" height="240px" AllowReorder="True"> <HeaderTemplate> <div style="text-align: center; background-color: #EEE;"> <asp:Label ID="lblAllocated" runat="server" Text="Used fields"></asp:Label> </div> </HeaderTemplate> <ItemTemplate> <div style="width:auto"> <div style="float:left"><%#Eval("Text") %></div> <div style="float:Right"> <asp:CheckBox runat="server" ID="chkRequired" /> </div> </div> </ItemTemplate> </Telerik:RadListListBox>This is the cs file
protected void Page_Load(object sender, EventArgs e){ if (!Page.IsPostBack) { LoadFirstListBox(); LoadSecondListBox(); }}protected void LoadFirstListBox(){ // Same as LoadSecondListBox (see below)}protected void LoadSecondListBox(){ ListItemCollection lstAllocatedCollection = new ListItemCollection(); ListItem allocatedItem = new ListItem( "Test-1", "22"); allocatedItem.Attributes["Required"] = "true"; lstAllocatedCollection.Add(allocatedItem); allocatedItem = new ListItem( "Test-2", "33"); allocatedItem.Attributes["Required"] = "false"; lstAllocatedCollection.Add(allocatedItem); lstAllocated.DataSource = lstAllocatedCollection; lstAllocated.DataTextField = "Text"; lstAllocated.DataValueField = "Value"; lstAllocated.DataBind();}void AllocatedListDataBound(object sender, Telerik.Web.UI.RadListBoxItemEventArgs e) { string checkedValue = (string) DataBinder.Eval(e.Item.DataItem, "Attributes['Required']"); CheckBox checkBox = (CheckBox)e.Item.FindControl("chkRequired"); checkBox.Checked = Convert.ToBoolean(checkedValue); }void lstAvailable_Transferred(object sender, Telerik.Web.UI.RadListBoxTransferredEventArgs e){ foreach(Telerik.Web.UI.RadListBoxItem item in e.Items) { item.DataBind(); // Pretty much unnecessary because I am not really changing anything here }}After transferring an empty text is transferred... see attachment. What am I doing wrong?
