This is a migrated thread and some comments may be shown as answers.
Transferring from unbound to bound results in blank items
1 Answer 17 Views
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 22 Dec 2011, 08:53 PM
I'm attempting to transfer items from an unbound listbox (populated at runtime) to a bound listbox (populated with a SQL data source) and the items transfer, but are blank.  Any samples out there that I can look at to get this working? 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 23 Dec 2011, 06:49 AM
Hello,

I have tried to reproduce the same but no avail. You can try the following.

ASPX:
<telerik:RadListBox ID="RadListBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="EmployeeID" DataValueField="EmployeeID">
</telerik:RadListBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT top 5 * FROM [Employees]"></asp:SqlDataSource>

CS:
protected void Page_Load(object sender, EventArgs e)
   {
       SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString());
       RadListBox RadListBox2 = new RadListBox();
       string s = "select top 5 * from Employees";
       con.Open();
       SqlDataAdapter dr = new SqlDataAdapter(s, con);
       DataTable dt = new DataTable();
       dr.Fill(dt);
       con.Close();
       RadListBox2.DataSource = dt;
       RadListBox2.DataTextField = "FirstName";
       RadListBox2.DataValueField = "FirstName";
       RadListBox2.DataBind();
       RadListBox2.AllowTransfer=true;
       RadListBox2.TransferToID="RadListBox1";
       form1.Controls.Add(RadListBox2);
   }

Thanks,
Princy.
Asked by
Brandon
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or