I have a radgrid with more than 35 columns(headers). I want to edit a record(edit mode=popup) it encounter the following error. "Sys.WebForms.PageRequestManagerServerErrorException: Editor cannot be initialized for column: 36".
Please help..
Please help..
4 Answers, 1 is accepted
0
Hello Siva,
Based on the information provided it is hard to say what is causing this behaviour at your end. Could you please post you aspx code with the related code behind, so we could give you a more straight forward solution?
Kind regards,
Angel Petrov
the Telerik team
Based on the information provided it is hard to say what is causing this behaviour at your end. Could you please post you aspx code with the related code behind, so we could give you a more straight forward solution?
Kind regards,
Angel Petrov
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
Siva
Top achievements
Rank 1
answered on 02 Nov 2012, 05:33 AM
Thanks for rpy
Here is my aspx code:
<div>
<telerik:RadGrid AutoGenerateColumns="false" ID="rgControl" Width="100%" AllowFilteringByColumn="True"
AllowSorting="True" PageSize="15" ShowFooter="True" AllowPaging="True" runat="server"
GridLines="None" OnNeedDataSource="rgControl_NeedDataSource" OnItemCommand="rgControl_ItemCommand"
CellSpacing="0" EnableEmbeddedSkins="false" CssClass="RadGridCustomClass" OnColumnCreated="rgControl_ColumnCreated"
Height="520px" AutoGenerateEditColumn="true" OnItemDataBound="rgControl_ItemDataBound" OnPreRender="rgControl_PreRender">
<ClientSettings Resizing-AllowColumnResize="true">
<Selecting AllowRowSelect="true" />
<Scrolling AllowScroll="true" ScrollHeight="400px" UseStaticHeaders="true" />
</ClientSettings>
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="true" EditMode="PopUp" AllowFilteringByColumn="True"
ShowFooter="True" TableLayout="Auto" AllowAutomaticUpdates="true">
<EditFormSettings CaptionFormatString="Add/Edit Mode" PopUpSettings-ScrollBars="Auto">
<PopUpSettings Height="300" Width="900" Modal="true" ShowCaptionInEditForm="false" />
</EditFormSettings>
<Columns>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
My Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void rgControl_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
try
{
rgControl.DataSource = GetDataTable("Select * from abc");// abc table having more than 35 columns
rgControl.Rebind();
}
catch (Exception ex)
{
}
}
#region " ITEM DATA BOUND "
protected void rgControl_ItemDataBound(object sender, GridItemEventArgs e)
{
try
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
foreach (GridColumn gc in rgControl.MasterTableView.AutoGeneratedColumns)
{
TextBox txt = (TextBox)item[gc].Controls[0];
if (txt != null)
txt.Width = Unit.Pixel(160);// I want 160 px width for each text box
}
}
}
catch (Exception ex)
{
}
}
#endregion
#region " PRE RENDER "
protected void rgControl_PreRender(object sender, EventArgs e)
{
// I need 7 text boxes for column. So I am setting EditFormColumnIndex
try
{
int j = 0, k = 1;
foreach (GridColumn gc in rgControl.MasterTableView.AutoGeneratedColumns)
{
if (j < k * 7)
{
gc.EditFormColumnIndex = k - 1;
}
else
{
k++;
gc.EditFormColumnIndex = k - 1;
}
j++;
} /// I think here is the mistake(for edited items)
}
catch (Exception ex)
{
}
}
#endregion
In prerender method i am setting edit from index( i am not initialized any editor item from code behind.). when i remove the above code(logic) it working good. can u suggest me to set editcolumnindex(in popup). or any other solution ?..
"Error: " Sys.WebForms.PageRequestManagerServerErrorException: Editor cannot be initialized for column:5 .
Here is my aspx code:
<div>
<telerik:RadGrid AutoGenerateColumns="false" ID="rgControl" Width="100%" AllowFilteringByColumn="True"
AllowSorting="True" PageSize="15" ShowFooter="True" AllowPaging="True" runat="server"
GridLines="None" OnNeedDataSource="rgControl_NeedDataSource" OnItemCommand="rgControl_ItemCommand"
CellSpacing="0" EnableEmbeddedSkins="false" CssClass="RadGridCustomClass" OnColumnCreated="rgControl_ColumnCreated"
Height="520px" AutoGenerateEditColumn="true" OnItemDataBound="rgControl_ItemDataBound" OnPreRender="rgControl_PreRender">
<ClientSettings Resizing-AllowColumnResize="true">
<Selecting AllowRowSelect="true" />
<Scrolling AllowScroll="true" ScrollHeight="400px" UseStaticHeaders="true" />
</ClientSettings>
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="true" EditMode="PopUp" AllowFilteringByColumn="True"
ShowFooter="True" TableLayout="Auto" AllowAutomaticUpdates="true">
<EditFormSettings CaptionFormatString="Add/Edit Mode" PopUpSettings-ScrollBars="Auto">
<PopUpSettings Height="300" Width="900" Modal="true" ShowCaptionInEditForm="false" />
</EditFormSettings>
<Columns>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
My Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void rgControl_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
try
{
rgControl.DataSource = GetDataTable("Select * from abc");// abc table having more than 35 columns
rgControl.Rebind();
}
catch (Exception ex)
{
}
}
#region " ITEM DATA BOUND "
protected void rgControl_ItemDataBound(object sender, GridItemEventArgs e)
{
try
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
foreach (GridColumn gc in rgControl.MasterTableView.AutoGeneratedColumns)
{
TextBox txt = (TextBox)item[gc].Controls[0];
if (txt != null)
txt.Width = Unit.Pixel(160);// I want 160 px width for each text box
}
}
}
catch (Exception ex)
{
}
}
#endregion
#region " PRE RENDER "
protected void rgControl_PreRender(object sender, EventArgs e)
{
// I need 7 text boxes for column. So I am setting EditFormColumnIndex
try
{
int j = 0, k = 1;
foreach (GridColumn gc in rgControl.MasterTableView.AutoGeneratedColumns)
{
if (j < k * 7)
{
gc.EditFormColumnIndex = k - 1;
}
else
{
k++;
gc.EditFormColumnIndex = k - 1;
}
j++;
} /// I think here is the mistake(for edited items)
}
catch (Exception ex)
{
}
}
#endregion
In prerender method i am setting edit from index( i am not initialized any editor item from code behind.). when i remove the above code(logic) it working good. can u suggest me to set editcolumnindex(in popup). or any other solution ?..
"Error: " Sys.WebForms.PageRequestManagerServerErrorException: Editor cannot be initialized for column:5 .
0
Hi Siva,
I examined your code carefully and there are some issues that need to be cleared.
Regards,
Angel Petrov
the Telerik team
I examined your code carefully and there are some issues that need to be cleared.
- EditFormColumnIndex works only when EditMode is set to EditForms and EditFormSettings-ColumnsCount is set to a number larger than 1. This property specifies in which column of the edit form the edit field for this column will reside.
- Also you should not call Rebind() or DataBind() method in the NeedDataSource (please review the following help article).
Regards,
Angel Petrov
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
Siva
Top achievements
Rank 1
answered on 07 Nov 2012, 05:53 AM
Thank you very much for your answer.
By setting Columnnumber in editform my problem was solved.
By setting Columnnumber in editform my problem was solved.
<
EditFormSettings
ColumnNumber
=
"15"
/>