DataSource for Pivot grid

2 posts, 0 answers
  1. Achuthan
    Achuthan avatar
    31 posts
    Member since:
    May 2007

    Posted 29 Jul 2013 Link to this post

    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.
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 01 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top