Transferring from unbound to bound results in blank items

2 posts, 0 answers
  1. Brandon
    Brandon avatar
    2 posts
    Member since:
    Apr 2011

    Posted 22 Dec 2011 Link to this post

    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? 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Dec 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top