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

Fieldname captions

6 Answers 156 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 03 Dec 2012, 04:43 PM
We've noticed that if we include a column in the pivotgrid, and give it a caption, that's the value that shows up in the configuration panel. All OTHER fields are picked up automatically from the data source, but the value that shows is the field name, which isn't always meaningful to the user.

Is it possible to define captions for all fields, even those that are not initially included in the pivotgrid?

6 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 06 Dec 2012, 09:47 AM
Hi Derek,

To achieve the desired functionality you could try using the following approach:
On RadPivotGrid.PreRender event you could get all fields via RadPivotGrid.Fields collection. Then you could iterate and set custom caption to each of them.
Additionally I am sending you a simple example which demonstrates that.

I hope this helps.

Greetings,
Radoslav
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.
0
Derek
Top achievements
Rank 1
answered on 07 Nov 2013, 07:44 PM
Thanks for the response.

This works, but we've run into another issue. If we put a RadAjaxManager on the page, the field captions aren't updated when the page loads,only AFTER the control is re-loaded (ie when adding a field to the grid). If we remove the RadAjaxManager everything works as expected.

Is there a way to get this to work on page load, while still using RadAjaxManager?
0
Accepted
Antonio Stoilkov
Telerik team
answered on 13 Nov 2013, 10:54 AM
Hi Derek,

In order to resolve your issue you could try one of the following approaches:
  • Ensure that the RadAjaxManager is updating the RadPivotGrid control. The RadPivotGrid should be part of the ajaxified controls collection for the ajax initiator as shown in the example below
<telerik:RadAjaxManager runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadPivotGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadPivotGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
  • You could try calling RadPivotGrid Rebind method after you have set the Caption value of the PivotGridField
void RadPivotGrid1_PreRender(object sender, EventArgs e)
{
    for (int i = 0; i < RadPivotGrid1.Fields.Count; i++)
    {
        RadPivotGrid1.Fields[i].Caption = (i + 1).ToString();
    }
    RadPivotGrid1.Rebind();
}

Regards,
Antonio Stoilkov
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.
0
Derek
Top achievements
Rank 1
answered on 13 Nov 2013, 12:10 PM
We had initially used the Ajax Manager, and the pivot was referenced correctly in the Ajax Manager, but we found that the field names weren't being updated until the pivot grid was refreshed.

Including the rebind in the PreRender event resolved that, but note that BOTH were required to get it to work properly; the grid is referenced in the Ajax Manager, and the rebind is called at the end of the PreRender event.
0
Bob
Top achievements
Rank 1
answered on 21 May 2014, 04:44 PM
Hi there,

I have the same problem. The only difference is that it's an OLAP bound RadPivotGrid.
Even in the PreRender the field collection is not filled yet.
How can i reach all the fields to change their captions?

Kind regards,

Bob Gladon
 
0
Antonio Stoilkov
Telerik team
answered on 26 May 2014, 06:11 AM
Hi Bob,

You could try achieving your scenario by subscribing to RadPivotGrid FieldCreated event and changing the captions of the fields there. Note that fields are not created when hidden. You could change the captions of the fields only if they are in the RadPivotGrid Fields collection. Fields are added to the collection when dragged from the Configuration Panel or manually added to the collection in the markup or programatically in code behind.

Regards,
Antonio Stoilkov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PivotGrid
Asked by
Derek
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Derek
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Bob
Top achievements
Rank 1
Share this question
or