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

PivotGrid AggregateField Textbox Error

1 Answer 58 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 11 Nov 2013, 02:48 AM
Hi,
In my telerik grid AggregateFiled,I have bind Text box.
This works fine but when i click  on any button on page it shows me java script error message .
i have attached Image for more details.
if i replace Textbox with Lable its working fine.In my case i want to add text box to aggregate field and end user can edit the value and need to save the data.
here is my code.

By Code : Iam getting Error1.jpg
 TelerikPivotGridHelper.PivotGridAggregateFiled(RadGrid1, "", "LoadHours", "LoadHours", 60, "{0:F2}", "{0:F2}", TelerikControlType.TextBox, "lblAmount");

 #region PivotGridAggregateFiled
    public static void PivotGridAggregateFiled(RadPivotGrid grid, String headertext, String datafield, String UniqueName, int Width, String DataFormatString, String totalformatString, TelerikControlType Columntype, String contolID)
    {
        PivotGridAggregateField aggregateField = new PivotGridAggregateField();
        if (Columntype != TelerikControlType.None)
        {
            aggregateField.CellTemplate = new MyTemplate(datafield, Columntype.ToString(), Width - 2, contolID);
        }
        aggregateField.DataField = datafield;
        aggregateField.UniqueName = UniqueName;
        aggregateField.CellStyle.Width = Width;
        aggregateField.DataFormatString = DataFormatString;
        aggregateField.TotalFormatString = totalformatString;
        aggregateField.Caption = headertext;
        grid.Fields.Add(aggregateField);

    }
    #endregion



 public void txtbox1_DataBinding(object sender, EventArgs e)
        {
            TextBox txtbox1 = (TextBox)sender;
            PivotGridDataCell container = (PivotGridDataCell)txtbox1.NamingContainer;
            if (container.DataItem != null)
            {
                txtbox1.Text = container.DataItem.ToString();
            }
            else
            {
                txtbox1.Text = "0";
            }
        }

by Design : Iam getting Error2.jpg
 <telerik:PivotGridAggregateField DataField="LoadHours"  CellStyle-Width="60px">
                <celltemplate >   
                <asp:TextBox ID='txtloadhours' runat="server" Width="46" Text='<%# Container.DataItem%>' ></asp:TextBox>
                <%--  <asp:TextBox ID='txtloadhours' runat="server" Width="46" Text='<%# ProcessMyDataItem(Container.DataItem) %>' ></asp:TextBox>--%>

 
                  </celltemplate>         
                </telerik:PivotGridAggregateField>   

1 Answer, 1 is accepted

Sort by
0
Syed
Top achievements
Rank 1
answered on 11 Nov 2013, 04:13 AM
Hi,
i find the Solution ,its not due to Telrik Pivot grid,here iam adding many text box to the pivot grid for that in web.config.i add this line.Now its working fine.
 <appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="10000" />
  </appSettings>
Tags
PivotGrid
Asked by
Syed
Top achievements
Rank 1
Answers by
Syed
Top achievements
Rank 1
Share this question
or