How to have names of my own in pivot grid

2 posts, 0 answers
  1. Dorababu
    Dorababu avatar
    95 posts
    Member since:
    May 2012

    Posted 28 Sep 2012 Link to this post

    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
  2. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 02 Oct 2012 Link to this post

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