Ticket T369657
Visible to All Users

Binding Datatable to XRTable in XtraReport

created 9 years ago

Hi,

I would just like to know how to bind a DataTable to an XrTable inside of the XtraReport.

I managed to set a Datasource for the XtraReport itself, but how do I do that to the XrTable? And I also wanted to produce columns to the XRTable based on the columns inside of the Datatable.

Hope you have a solution for this.

Thanks.

Comments (1)

    Also: I would like to bind during runtime since the columns inside the DataTable are dynamic.

    Answers approved by DevExpress Support

    created 9 years ago

    Hello Willson,

    Note that it's not necessary to bind the XRTable to the data source columns, but the XtraReport itself and the XRTableCells that reside within a table. I suggest that you check the How to create a report dynamically Knowledge Base article that demonstrates runtime creation.

    Let me know if you have further questions.
    Thanks,
    Dmitry

      Show previous comments (1)
      DevExpress Support Team 9 years ago

        Hello,
        I've recorded a video illustrating how to bind XRTable cells to data fields at design time. Please review it. If your task is to set up bindings in code, use code snippets from the How to dynamically generate a report and bind it to a DataSet in a WinForms application code example (you need to use the XRControl.DataBindings property).
        Please let me know if this information is helpful.

          Hi Olga,

          Yes i'd understand that I can bind XrTableCells to the SQLDataSource.

          But my datasource is a DataTable and the DataTable is generated during runtime. I would just like to know how I can bind the DataTable generated during runtime.

          DevExpress Support Team 9 years ago

            Hello,
            If you create your DataTable at runtime, you can set up control bindings in code. As I suggested in my previous comment, use the XRControl.DataBindings property for this purpose:

            Visual Basic
            xrTableCell1.DataBindings.Add("Text", Nothing, "TableColumn1") xrTableCell2.DataBindings.Add("Text", Nothing, "TableColumn2")

            Please let me know if this solution helps.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.