0

I’ve got a custom Data access layer in my ASP.NET project. It goes to the db and retrieves all data required and returns it as DataTable objects. I want to bind one of the DataTables to DevExpress ComboBox control:

var productsDal = DalProviderFactory.Instance.GetProductsDal();
cbProducts.DataSource = productsDal.GetAllProductNames(); //--> One-column DataTable object is returned here.
cbProducts.DataMember = "ProductName"; //--> Specifying name of the column.
cbProducts.DataBind(); 

This doesn’t work; it definitely binds something but doesn’t display it properly:

enter image description here

Ok. I found out that the ComboBox actually accepts SqlDataSource object as its DataSource. So I’ce tried to configure one:

<asp:SqlDataSource ID="dsProducts" runat="server" />

Now instead of having it connecting to the db itself, I want to use my DAL and somehow assign the datatable to the SqlDataSource. Is there any way of doing this?

Thanks in advance.

2 Answers 2

1

Bashir,

use the TextField property of ASPxComboBox:

<dx:ASPxComboBox runat="server" TextField="HERE" />
Sign up to request clarification or add additional context in comments.

1 Comment

I always wonder why DevExpress developers change standard names to something completely misleading :(. It is like this in WinForms controls (one particular thing that drives me crazy – when you need to use Hidden instead of Visible for visual controls) and now I see exactly the same stuff in WebForms. :( Anyway thank you very much! Spasibo! :)
0

Setting the DisplayMember should fix the problem.

1 Comment

There is no DisplayMember property in ASPxComboBox class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.