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


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

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

    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";
           SqlDataAdapter dr = new SqlDataAdapter(s, con);
           DataTable dt = new DataTable();
           RadListBox2.DataSource = dt;
           RadListBox2.DataTextField = "FirstName";
           RadListBox2.DataValueField = "FirstName";

Back to Top