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>