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

DataSource for Pivot grid

1 Answer 92 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Achuthan
Top achievements
Rank 1
Achuthan asked on 29 Jul 2013, 02:17 PM
Hi,

            i want  to assign the SQL table  as datasource for pivotgrid.

My code:

void RadPivotGrid1_NeedDataSource(object sender, PivotGridNeedDataSourceEventArgs e)
        {
            (sender as RadPivotGrid).DataSource = GetDataTable();
        }

  private DataTable GetDataTable()
        {
            DataTable dt = new DataTable();
            using (SqlConnection conn = new SqlConnection("Data Source=zbserver01;initial Catalog=Sales;User Id=XXX;Password=XXX"))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = conn;
                    cmd.CommandText = "Select * from Car";
                    SqlDataAdapter adpt = new SqlDataAdapter(cmd);

                    adpt.Fill(dt);
                }
                return dt;
            }

        }

 its just show the empty grid,if  i am  do like this.

Is it possible to assign a normal sql table as datasource for RadPivotGrid.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 01 Aug 2013, 08:48 AM
Hello,

Please review the online demo below which demonstrates the proper approach for achieving the required functionality:
http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/databinding/advanceddatabinding/defaultcs.aspx

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
PivotGrid
Asked by
Achuthan
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or