Dear telerik,
I have create a listbox with template item, the problem when trying to transfer items it transfered but it appears empty
please help
ASPX:
CS:
I have create a listbox with template item, the problem when trying to transfer items it transfered but it appears empty
please help
ASPX:
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel3"> <telerik:RadListBox ID="RadListBox5" runat="server" Height="150px" Width="215px" SelectionMode="Single" AutoPostBackOnTransfer="true" AllowTransfer="true" TransferToID="RadListBox6" OnTransferred="RadListBox5_Transferred"> <ButtonSettings ShowTransferAll="false" VerticalAlign="Middle" /> <ItemTemplate> <table cellpadding="1" cellspacing="0" border="0"> <tr> <td><b><%# Eval("Title") %></b></td> <td> [Price:</td> <td><%# Convert.ToInt32(Eval("Price")).ToString("C0")%>]</td> </tr> </table> </ItemTemplate> </telerik:RadListBox> <telerik:RadListBox ID="RadListBox6" runat="server" Height="150px" Width="200px" SelectionMode="Single"> <ItemTemplate> <table cellpadding="1" cellspacing="0" border="0"> <tr> <td><b><%# Eval("Title") %></b></td> <td> [Price:</td> <td><%# Convert.ToInt32(Eval("Price")).ToString("C0")%>]</td> </tr> <tr> <td colspan="3"> Quantity: <telerik:RadNumericTextBox runat="server" ID="QuantityTextBox" Width="80px" MinValue="1" MaxValue="10" ShowSpinButtons="true" Value="1" NumberFormat-DecimalDigits="0" /> <asp:RequiredFieldValidator ID="RequiredQuantityTextBox" ControlToValidate="QuantityTextBox" runat="server" ErrorMessage="*">*</asp:RequiredFieldValidator> </td> </tr> </table> </ItemTemplate> </telerik:RadListBox></telerik:RadAjaxPanel>CS:
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { RadListBox5_Load(); RadListBox6_Load(); } } public class Spinning { public string Title { get; set; } public double Price { get; set; } public int Quantity { get; set; } } void RadListBox5_Load() { List<Spinning> SpinningList = new List<Spinning> { new Spinning { Title = "Spinning Reel 1", Price = 100, Quantity = 1 }, new Spinning { Title = "Spinning Reel 2", Price = 200, Quantity = 2 }, new Spinning { Title = "Spinning Reel 3", Price = 300, Quantity = 3 } }; RadListBox5.DataSource = SpinningList; RadListBox5.DataBind(); } void RadListBox6_Load() { List<Spinning> SpinningList = new List<Spinning> { new Spinning { Title = "Spinning Reel 4", Price = 400, Quantity = 4 }, new Spinning { Title = "Spinning Reel 5", Price = 500, Quantity = 5 }, new Spinning { Title = "Spinning Reel 6", Price = 600, Quantity = 6 } }; RadListBox6.DataSource = SpinningList; RadListBox6.DataBind(); } protected void RadListBox5_Transferred(object sender, RadListBoxTransferredEventArgs e) { foreach (RadListBoxItem item in e.Items) { item.DataBind(); } }