RadControls version | RadControls for ASP.NET AJAX Q1 2010 SP2 |
.NET version | 3.5 |
Visual Studio version | 2008 |
programming language | C# |
PROJECT DESCRIPTION
I am allowing users to update SQL records through a rad grid. I use a radEditor in a template. I need to allow users to click a button and import the attribute in the previous record. I am running into a problem with the reference to teh RadEditor Client script. I added this script to handle my custiom tool inside the template like so:
ASPX Template Markup
<
telerik:GridTemplateColumn
HeaderText
=
"Narrative"
UniqueName
=
"Narrative"
DataField
=
"Narrative"
>
<
EditItemTemplate
>
<
telerik:RadEditor
ID
=
"reNarrative"
runat
=
"server"
SkinID
=
"ScorecardInput"
Content='<%#Bind("Narrative")
%>'>
</
telerik:RadEditor
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
Telerik.Web.UI.Editor.CommandList["ImportNarrative"] =
function(commandName, editor, args) {
editor.pasteHtml('Test narrative here');
};
</
script
>
</
telerik:RadCodeBlock
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblNarrative"
runat
=
"server"
Text='<%# Eval("Narrative")
%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Code behind (I define the structure of the tools in my code behind)
EditorToolGroup
etgNarrative =
new
EditorToolGroup();
EditorTool
etImportNarrative =
new
EditorTool(
"ImportNarrative"
);
etImportNarrative.ShowText
=
true
;
etImportNarrative.ShowIcon
=
false
;
etImportNarrative.Text
=
"Import Last Narrative"
;
etgNarrative.Tools.Add(etImportNarrative);
neweditor.Tools.Add(etgNarrative);
This works fine unless the user clicks edit on another row in the grid. Once this happens the javascript declaration adding my custom button to the command list does not happen. I get the error "The command ImportNarrative is not implimented yet" - even though I have explicitly done so in the template right after the RadEditor code.
If I could create a reference to the RadEditor API without placing it on my page, I could put the script at the top of the page so it is always run.
Any help would be appreciated.