cancel
Showing results for 
Search instead for 
Did you mean: 

How to Bind PDK Table control to a datatable?

Former Member
0 Kudos

Hi,

I'm trying to bind PDK table control to a datatable object, where the result is read from connector:


DataTable dt = 
     getFirstTenRecordsFromEkko(); 
       // from backend system
// table is SAP.Web.UI.Controls.Table
table.DataSource = dt;
table.AutoGenerateColumns = true;
table.DataBind(); // This displays nothing
// however, binding to gridview works
// gv is a gridview
gv.DataSource = dt;
gv.DataBind();

I'm using PDK for .NET v 2.5.

Please advise what I'm missing and thanks in advance,

Ali.

Accepted Solutions (0)

Answers (1)

Answers (1)

rima-sirich
Advisor
Advisor
0 Kudos

Hi Ali,

From SAP Table Datasource property reference [documentation|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/lw/developercontent/sap%20portal%20development%20kit%20for%20.net%20developer's%20Guide/SAP.WebSAP.Web.UI.Controls.TableDataSource.html] follows that SAP Table Datasource object should implement IEnumerable interface.

From DataTable class [documentation|http://msdn2.microsoft.com/en-us/library/system.data.datatable.aspx] follows that DataTable class doesn't implement IEnumerable interface.

I believe that this mismatch causes a problem that you experience in SAP Table databinding.

I think that you can use [BindingList<>|http://msdn2.microsoft.com/en-us/library/ms132679.aspx] generic class for databinding. For example, if you want to display flights list in SAP Table, define Flight class for flight details and databind to SAP Table object of type BindingList<Flight>.

Regards,

Rima.