I have a DetailsView control that I want to populate with a data table. I’m doing this in code behind. After checking that the data table is created successfully, the code is:
detailsView.DataSource = dataTable;
detailsView.DataBind();
I run the program and the detailsView doesn’t show.Could the problem be that a data table potentially can have multiple rows and a details view only one? If that’s the problem is there a way of getting around it? I made sure in creating the data table that it has only one row. I also tried binding only one row in the data table but a data table row isn’t accepted as a data source. What’s the problem?
You have to add in a
Bound fieldor Set the DetailsViewAutoGenerateRows="true"to display the field in the detailsView. I am sure you forget to do this..