Sorry for what is likely a repeat of past threads, but in spite of looking through the forum, I can't seem to get this to work. I have 2 listboxes, the "source" listbox is databound to a LINQ query and I want to be able to transfer items to a second listbox. In spite of (I think) carefully following the past examples, I can't get it working. The "transfered" event on the source doesn't appear to be firing at all, and when I attempt to do a transfer even of a single item, both listboxes wind up empty. I'd be very veryyyyyyy grateful for any guidance. My listboxes are defined as such:
And my code behind is as follows:
<
div
class
=
"left"
>
<
telerik:RadListBox
ID
=
"ticketListbox"
runat
=
"server"
ItemPlaceholderID
=
"TicketContainer"
EnableViewState
=
"False"
Font-Names
=
""Helvetica 65 Medium",Arial,sans-serif"
Font-Size
=
"Medium"
ForeColor
=
"#C36029"
Width
=
"275px"
AllowTransfer
=
"True"
TransferToID
=
"splitListbox"
AutoPostBackOnTransfer
=
"True"
SelectionMode
=
"Multiple"
ontransferred
=
"ticketListbox_Transferred"
>
<
ButtonSettings
TransferButtons
=
"All"
></
ButtonSettings
>
<
ItemTemplate
>
<
table
style
=
"font-family: Arial, Helvetica, sans-serif; font-size: medium; color: #C36029"
>
<
td
>
<%#Eval("Quantity")%>
</
td
>
<
td
>
<%#Eval("Name")%>
</
td
>
<
td
>
<%#Eval("Price","{0:c}")%>
</
td
>
</
table
>
</
ItemTemplate
>
</
telerik:RadListBox
>
</
div
>
<
div
class
=
"centerElements"
>
<
telerik:RadListBox
ID
=
"splitListbox"
runat
=
"server"
ItemPlaceholderID
=
"splitContainer"
EnableViewState
=
"False"
Font-Names
=
""Helvetica 65 Medium",Arial,sans-serif"
Font-Size
=
"Medium"
ForeColor
=
"#C36029"
Width
=
"275px"
AllowTransfer
=
"False"
>
<
ButtonSettings
TransferButtons
=
"All"
></
ButtonSettings
>
<
ItemTemplate
>
<
table
style
=
"font-family: Arial, Helvetica, sans-serif; font-size: medium; color: #C36029"
>
<
td
>
<%#Eval("Quantity")%>
</
td
>
<
td
>
<%#Eval("Name")%>
</
td
>
<
td
>
<%#Eval("Price","{0:c}")%>
</
td
>
</
table
>
</
ItemTemplate
>
</
telerik:RadListBox
>
</
div
>
And my code behind is as follows:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!User.Identity.IsAuthenticated)
{
Response.Redirect(
"http://localhost:64501/LogOn.aspx"
);
}
if
(!Page.IsPostBack)
{
ticketListbox.DataBind();
splitListbox.DataBind();
}
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
CaffeBravoContext tc =
new
CaffeBravoContext();
int
tableNo = System.Convert.ToInt16(tableTextbox.Text);
var table = from t
in
tc.Tickets
where (t.Table==tableNo)&&
(t.Closed_==
false
)
select t;
if
(table.Count()==0)
{
statusLbl.Text=
"There is no open ticket for that table!"
;
}
else
{
var tickets = from d
in
tc.Ticket_Details
where d.Ticket_ == table.FirstOrDefault().Ticket_Number
select d;
ticketListbox.DataSource = tickets.ToList();
ticketListbox.DataBind();
}
}
protected
void
ticketListbox_Transferred(
object
sender, RadListBoxTransferredEventArgs e)
{
foreach
(RadListBoxItem item
in
e.Items)
{
item.DataBind();
}
}
}
}