Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
Problem Databinding with WebDropDown
posted

Ok, I'm a complete novice with Infragistics controls, but I've been doing .NET and other 3rd party controls for years.

I just downloaded the latest version and I'm starting a new project - I thought that I'd start with a simple task - bind a list of products to the Webdropdown.  After all, I've done this for years using the standard <asp:dropdownlist>  control.

When I run the page, the webDropDown contains "System.Object[]" repeated 6 times (because my sql statement is only returning 6 rows). Why isn't it databinding??

Yes, the SQL works....   Yes, If I databind to a <asp:Dropdownlist> it works......  So why does the WebDropDown display "System.Object[]"   ?

Thanks - Jim

HTML:

<ig:WebDropDown ID="WebDropDown_Products" runat="server" Width="200px">
            </ig:WebDropDown>

 

Code Behind:

protected void Load_WebDropDown_Products()
    {
      string queryString = "select top 6 prod_code from ProductCodes";


      using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["xxxxxx_ConnectionString"].ConnectionString))
      {
        System.Data.SqlClient.SqlCommand mysqlCommand = new System.Data.SqlClient.SqlCommand(queryString, myConnection);
        myConnection.Open();
        SqlDataReader myDataReader = mysqlCommand.ExecuteReader();
        WebDropDown_Products.DataSource = myDataReader;
        WebDropDown_Products.ValueField = "prod_code";
        WebDropDown_Products.TextField = "prod_code";
        WebDropDown_Products.DataBind();
        myDataReader.Close();
      }
    }

Parents Reply Children
No Data