I wants to bind data to pivot grid using code not by SqlDataSource.
private void Report_Summary_Load(object sender,EventArgs e)
{
string cs= configuraitonManager.connectionString["connectionStringDatabase"].connectionString;
using(SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("spStoredProcedureTest",con);
cmd.CommandType = CommandType.StoredProcedure;
con.open();
SqlDataReader sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
pivotGrid.DataSource = ds;
PivotGridField Name = new PivotGridField("Name",PivotArea.RowArea);
PivotGrid.Fields.AddRange(new PivotGridField[] {Name});
Name.AreaIndex = 0;
// My pivot grid name is "pivotGridDemo"
//How to bind the data to the data area,column area and Row area
}
}
I have 5 Fields
Name,Standard,City,Age,DobYear
I wants to set Name and City in row area,City in column area,Age and DobYear in data area
Updated
The above code is adding Name is Row field. But not displaying records
Try this :