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

How to have names of my own in pivot grid

1 Answer 91 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Dorababu
Top achievements
Rank 1
Dorababu asked on 28 Sep 2012, 06:14 AM
Hi all I have designed my pivot grid as follows

<telerik:RadPivotGrid EnableViewState="true" AllowPaging="true" PageSize="10" Width="800px"
            ViewStateMode="Inherit" ID="RadPivotGrid1" runat="server" ColumnHeaderZoneText="ColumnHeaderZone"
            ShowColumnHeaderZone="true" ShowDataHeaderZone="False" OnNeedDataSource="RadPivotGrid1_NeedDataSource">
            <ClientSettings AllowFieldsReordering="True">
                <Scrolling AllowVerticalScroll="True" ScrollHeight="320px" />
            </ClientSettings>
            <Fields>
                <telerik:PivotGridRowField DataField="EmpID" ZoneIndex="0">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="PayeeName" ZoneIndex="1">
                </telerik:PivotGridRowField>
                <telerik:PivotGridColumnField DataField="BankAccountType">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridAggregateField DataField="BankRoutingNumber">
                </telerik:PivotGridAggregateField>
                <telerik:PivotGridAggregateField DataField="BankAccount">
                </telerik:PivotGridAggregateField>
            </Fields>
            <TotalsSettings GrandTotalsVisibility="None" />
            <ZoneContextMenu EnableTheming="True" ID="rpgzcMenu">
            </ZoneContextMenu>
        </telerik:RadPivotGrid>

And my code for binding is as follows

protected void RadPivotGrid1_NeedDataSource(object sender, Telerik.Web.UI.PivotGridNeedDataSourceEventArgs e)
    {
        MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["sqlcon1"].ConnectionString);
        MySqlCommand cmd = new MySqlCommand("select EmpID,BankAccountType,PayeeName,BankRoutingNumber,BankAccount,Amount from tblemployeebankdata where EmpID=1021", con);
        con.Open();
        MySqlDataAdapter da = new MySqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds);
        RadPivotGrid1.DataSource = ds;
    }
  
My pivot grid looks as follows

http://imageshack.us/photo/my-images/109/pivoto.jpg/

Can some one help me. Also how can I use edit and delete options in pivot grid

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 02 Oct 2012, 12:25 PM
Hello,

Try to modify your code as follows:

<telerik:RadPivotGrid EnableViewState="true" AllowPaging="true" PageSize="10" Width="800px"
            ViewStateMode="Inherit" ID="RadPivotGrid1" runat="server" ColumnHeaderZoneText="ColumnHeaderZone" TotalsSettings-GrandTotalsVisibility="None"
            ShowColumnHeaderZone="true" ShowDataHeaderZone="False" OnNeedDataSource="RadPivotGrid1_NeedDataSource">
            <ClientSettings AllowFieldsReordering="True">
                <Scrolling AllowVerticalScroll="True" ScrollHeight="320px" />
            </ClientSettings>
            <Fields>
                <telerik:PivotGridRowField DataField="EmpID" ZoneIndex="0">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="PayeeName" ZoneIndex="1">
                </telerik:PivotGridRowField>
                <telerik:PivotGridColumnField DataField="BankAccountType">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridAggregateField DataField="BankRoutingNumber" Caption="Your custom Text">
                </telerik:PivotGridAggregateField>
                <telerik:PivotGridAggregateField DataField="BankAccount">
                </telerik:PivotGridAggregateField>
            </Fields>
            <TotalsSettings GrandTotalsVisibility="None" />
            <ZoneContextMenu EnableTheming="True" ID="rpgzcMenu">
            </ZoneContextMenu>
        </telerik:RadPivotGrid>

Give this approach a try and check whether you get the desired behavior.

Kind regards,
Andrey
the Telerik team
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 their blog feed now.
Tags
PivotGrid
Asked by
Dorababu
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or