I have a radeditor control inside an asp.net form view insert item template.
As the user types text into the radeditor, I want to display the text/html inside a seperate label (within the same insert item template) in real time. (Yes, I know that the radeditor has a preview mode, but the real time preview must be seperate to the radeditor in my scenario).
This is my server side code:
This is my JavaScript code:
Also, I have attempted to implement the onClientLoad="onClientLoad" function of the RadEditor control, but I am unable to find the two required labels which are both inside the insert item template, such as:
<telerik:RadEditor ID="RadEditor1" runat="server" onClientLoad="OnClientLoad" />
Can anyone guide me on the correct syntax or correct coding to achieve this?
.
As the user types text into the radeditor, I want to display the text/html inside a seperate label (within the same insert item template) in real time. (Yes, I know that the radeditor has a preview mode, but the real time preview must be seperate to the radeditor in my scenario).
This is my server side code:
RadEditor re1 = (RadEditor)FormView_RISummaryDetailsFV.FindControl(
"RadEditorSummaryDescription_RISummaryDetailsFVEditItemTemplate"
);
Label lab1 = (Label)FormView_RISummaryDetailsFV.FindControl(
"LabelResumePreviewHeader_RISummaryDetailsFVEditItemTemplate"
);
Label lab2 = (Label)FormView_RISummaryDetailsFV.FindControl(
"LabelResumePreviewContents_RISummaryDetailsFVEditItemTemplate"
);
re1.Attributes.Add(
"onKeyUp"
,
"JavaScript:summaryRealTimePreview('"
+ re1.ClientID +
"', '"
+ lab1.ClientID +
"', '"
+ lab2.ClientID +
"');"
);
This is my JavaScript code:
<script type=
"text/javascript"
>
function
summaryRealTimePreview(re1_id, lab1_id, lab2_id) {
var
re1 = $find(re1_id);
var
lab1 = document.getElementById(lab1_id);
var
lab2 = document.getElementById(lab2_id);
lab1.innerHTML = re1.get_html();
lab2.innerHTML = re1.get_html();
}
</script>
Also, I have attempted to implement the onClientLoad="onClientLoad" function of the RadEditor control, but I am unable to find the two required labels which are both inside the insert item template, such as:
<telerik:RadEditor ID="RadEditor1" runat="server" onClientLoad="OnClientLoad" />
<script language=
"javascript"
type=
"text/javascript"
>
function
OnClientLoad(editor) {
var
element = document.all ? editor.get_document().body : editor.get_document();
$telerik.addExternalHandler(element,
"keyup"
, keyUpFunction);
}
function
keyUpFunction() {
alert(
"key up function tripped"
);
}
</script>
Can anyone guide me on the correct syntax or correct coding to achieve this?
.