Hi to all,
I'm facing an annoying problem with RadGrid OnInsertCommand + RadEditor, more specifically (following this demo on Telerik examples portal: http://demos.telerik.com/aspnet-ajax/editor/examples/edittemplate/defaultcs.aspx) I'm trying to handle the insert command from code behind and the problem is that I'm not able to get the 'Content' of the RadEditor after the Insert calls the code behind.
Some code will be more explicative:
.aspx (my RadGrid with RadEditor inside)
.aspx.cs
The problem is that when i hit the Insert and the debugger make me jump at 'Breakpoint1' my Content and Text are empty ("") instead of what I wrote before. When I hit Update in Edit mode (obviously debugger jump on 'Breakpoint2') Content and Text have the right values from the DataSource.
I'm sure that I get the right RadEditor Control both in Insert that in Update because if I change the properties of one of that I can use the debugger to obtain evidence that I'm taking the right control.
I'm saying that is a strange issue because if you try providing Datasource directly in the .aspx, like in the Telerik Demo, all works perfectly.
I have tried many approaches found on the internet and in many forums but no one fits with my problem and I can't find a working example of handling the Insert command.
Am I missing something?
Thanks in advance
M
I'm facing an annoying problem with RadGrid OnInsertCommand + RadEditor, more specifically (following this demo on Telerik examples portal: http://demos.telerik.com/aspnet-ajax/editor/examples/edittemplate/defaultcs.aspx) I'm trying to handle the insert command from code behind and the problem is that I'm not able to get the 'Content' of the RadEditor after the Insert calls the code behind.
Some code will be more explicative:
.aspx (my RadGrid with RadEditor inside)
<
telerik:RadGrid
ID
=
"Content_RadGrid"
runat
=
"server"
AutoGenerateColumns
=
"false"
AutoGenerateInsertColumn
=
"true"
AutoGenerateEditColumn
=
"true"
AutoGenerateDeleteColumn
=
"true"
OnInsertCommand
=
"Content_RadGrid_InsertCommand"
OnUpdateCommand
=
"Content_RadGrid_UpdateCommand"
>
<
MasterTableView
DataKeyNames
=
"pID"
CommandItemDisplay
=
"Bottom"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"ID"
Display
=
"true"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"IdLabel"
runat
=
"server"
Text='<%# Eval("pID") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"Content"
ItemStyle-HorizontalAlign
=
"Justify"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblField1"
CssClass
=
"text"
runat
=
"server"
Text='<%# Eval("Content") %>'></
asp:Label
>
</
ItemTemplate
>
<
InsertItemTemplate
>
<
telerik:RadEditor
ID
=
"Insert_RadEditor"
runat
=
"server"
Content='<%# Bind("Content") %>' Language="it-IT" EnableResize="false" Width="1000px" Height="300px">
<
Tools
>
<
telerik:EditorToolGroup
>
<
telerik:EditorTool
Name
=
"Cut"
></
telerik:EditorTool
>
<
telerik:EditorTool
Name
=
"Copy"
></
telerik:EditorTool
>
<
telerik:EditorTool
Name
=
"Paste"
></
telerik:EditorTool
>
</
telerik:EditorToolGroup
>
</
Tools
>
</
telerik:RadEditor
>
</
InsertItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadEditor
ID
=
"Update_RadEditor"
runat
=
"server"
Content='<%# Bind("Content") %>' Language="it-IT" EnableResize="false" Width="1000px" Height="300px">
<
Tools
>
<
telerik:EditorToolGroup
>
<
telerik:EditorTool
Name
=
"Cut"
></
telerik:EditorTool
>
<
telerik:EditorTool
Name
=
"Copy"
></
telerik:EditorTool
>
<
telerik:EditorTool
Name
=
"Paste"
></
telerik:EditorTool
>
</
telerik:EditorToolGroup
>
</
Tools
>
</
telerik:RadEditor
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
.aspx.cs
#region Test Methods
protected
void
Content_RadGrid_InsertCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
RadEditor rd = e.Item.FindControl(
"Insert_RadEditor"
)
as
RadEditor;
string
content = rd.Content;
string
text = rd.Text;
Response.Write(
"Breakpoint1"
);
}
protected
void
Content_RadGrid_UpdateCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
RadEditor rd = e.Item.FindControl(
"Update_RadEditor"
)
as
RadEditor;
string
content = rd.Content;
string
text = rd.Text;
Response.Write(
"Breakpoint2"
);
}
The problem is that when i hit the Insert and the debugger make me jump at 'Breakpoint1' my Content and Text are empty ("") instead of what I wrote before. When I hit Update in Edit mode (obviously debugger jump on 'Breakpoint2') Content and Text have the right values from the DataSource.
I'm sure that I get the right RadEditor Control both in Insert that in Update because if I change the properties of one of that I can use the debugger to obtain evidence that I'm taking the right control.
I'm saying that is a strange issue because if you try providing Datasource directly in the .aspx, like in the Telerik Demo, all works perfectly.
I have tried many approaches found on the internet and in many forums but no one fits with my problem and I can't find a working example of handling the Insert command.
Am I missing something?
Thanks in advance
M