This is a migrated thread and some comments may be shown as answers.

Generic IList as a datasource

6 Answers 520 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Grootjans
Top achievements
Rank 1
Grootjans asked on 19 Mar 2007, 10:44 AM
Hi,

I would like to create a  report based on a generic IList. How do I get the generic type to load in the report's design view? I can't seem to be able to add it as a datasource.

6 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 20 Mar 2007, 08:41 AM
Hi Michel,

Binding a report to a generic list is straightforward - simply pass the list to the report's DataSource property like this:

    class Report1 : Telerik.Reporting.Report
    {
        TextBox textBox1;
        DetailSection detail;

        public Report1()
        {
            this.InitializeComponent();

            List<string> list = new List<string>();
            for (int i = 0; i < 10; i++)
            {
                list.Add("Item #" + i);
            }

            this.DataSource = list;
        }

        void InitializeComponent()
        {
            ...           
            this.textBox1.Value = "=Item";
            ...
        }
    }


You can check out the ListBoundReport (either in C# or VB.NET) example where the report is bound to a list of custom objects.

Kind regards,
Svetoslav
the telerik team
0
Grootjans
Top achievements
Rank 1
answered on 20 Mar 2007, 10:13 AM
I found that in the examples part of the Beta2 download. The problem is that I can't visually edit my report. The datasource window remains empty.

Is it the aim of Telerik to support only visual report editing for dorect database connections?
0
Svetoslav
Telerik team
answered on 20 Mar 2007, 04:40 PM
Hi Michel,

Yes, we are currently working on adding new report and connect data source wizards that will provide support for consuming both database and business objects, etc.

Kind regards,
Svetoslav
the telerik team
0
wvanhooijdonk
Top achievements
Rank 1
answered on 10 Apr 2008, 06:40 PM
I've got a similar problem. I'd like to bind a RadGrid datasource to a List<string> (just a simple list of words). What DataField should I use?

By the way: greetings to you Michel !
0
Sebastian
Telerik team
answered on 11 Apr 2008, 06:53 AM
Hi wvanhooijdonk,

RadGrid supports data sources from the types listed in this section of the documentation:

http://www.telerik.com/help/aspnet/grid/?grdDataBindingBasics.html

For your case with generic list of strings you may consider specifying the DataFields for the grid columns using dot (.) syntax as shown in this online demo of the product:

http://www.telerik.com/demos/aspnet/Grid/Examples/Programming/Binding/DefaultCS.aspx (binding to sub-objects)

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Petr
Top achievements
Rank 1
answered on 01 Oct 2012, 01:07 PM
Hi,

it is possible to use in place editing when binding grid to an IList?

I can't get a OnUpdateCommand event to fire when pressing update button..

Thanks,
Petr
Tags
General Discussions
Asked by
Grootjans
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Grootjans
Top achievements
Rank 1
wvanhooijdonk
Top achievements
Rank 1
Sebastian
Telerik team
Petr
Top achievements
Rank 1
Share this question
or