Hello,
I come across a problem, which may be just silly, but I can not find the reason. I would appreciate to help me.
I created a WebUserControl containing three RadEditor, each for a different type of text (short text, medium text and large text). Through Javascript I check the maximum number of characters for the short and medium text (this works well):
This WebUserControl contains a function that saves the text to a database:
Here, for all the RadEditors (txtTextoCorto, txtTextoMedio and txtTextoLargo) always the Content property and Text property is empty.
I show the WebUserControl in an asp ModalPopupExtender and I call the GuardarTextos function from an external button.
Can you help me what I'm doing wrong?
Thank you very much.
I come across a problem, which may be just silly, but I can not find the reason. I would appreciate to help me.
I created a WebUserControl containing three RadEditor, each for a different type of text (short text, medium text and large text). Through Javascript I check the maximum number of characters for the short and medium text (this works well):
<script type="text/javascript"> var maxTextLength = 100; var maxTextLengthM = 250; var messageText = 'Ha superado el máximo permitido de ' + maxTextLength + ' caracteres para el Texto Corto!'; var messageTextM = 'Ha superado el máximo permitido de ' + maxTextLengthM + ' caracteres para el Texto Medio!'; function isAlphaNumericKey(keyCode) { if ((keyCode > 47 && keyCode < 58) || (keyCode > 64 && keyCode < 91)) { return true; } return false; } function LimitCharacters(editor) { editor.attachEventHandler("keydown", function (e) { e = (e == null) ? window.event : e; if (isAlphaNumericKey(e.keyCode)) { textLength = editor.get_text().length; if (textLength >= maxTextLength) { alert(messageText); e.returnValue = false; return false; } } }); } function LimitCharactersM(editor) { editor.attachEventHandler("keydown", function (e) { e = (e == null) ? window.event : e; if (isAlphaNumericKey(e.keyCode)) { textLength = editor.get_text().length; if (textLength >= maxTextLengthM) { alert(messageTextM); e.returnValue = false; return false; } } }); } function CalculateLength(editor, value) { var textLength = editor.get_text().length; var clipboardLength = value.length; textLength += clipboardLength; return textLength; } function OnClientPasteHtml(editor, args) { var commandName = args.get_commandName(); var value = args.get_value(); if (commandName == "PasteFromWord" || commandName == "PasteFromWordNoFontsNoSizes" || commandName == "PastePlainText" || commandName == "PasteAsHtml" || commandName == "Paste") { var textLength = CalculateLength(editor, value); if (textLength >= maxTextLength) { alert(messageText); args.set_cancel(true); } } } function OnClientPasteHtmlM(editor, args) { var commandName = args.get_commandName(); var value = args.get_value(); if (commandName == "PasteFromWord" || commandName == "PasteFromWordNoFontsNoSizes" || commandName == "PastePlainText" || commandName == "PasteAsHtml" || commandName == "Paste") { var textLength = CalculateLength(editor, value); if (textLength >= maxTextLengthM) { alert(messageTextM); args.set_cancel(true); } } }</script> <table style="width:500px; border:none;"> <tr> <td style="text-align:center; font-weight:bold; text-align:center;">Texto Corto </td> </tr> <tr> <td style="vertical-align:top;"> <telerik:RadEditor Language="es-ES" LocalizationPath="~/App_GlobalResources/" id="txtTextoCorto" runat="server" SkinID="DefaultSetOfTools" EditModes="Design" Skin="Sunset" ToolsFile="~/EditorOpcionesBasicas.xml" OnClientLoad="LimitCharacters" OnClientPasteHtml="OnClientPasteHtml" Height="120"> </telerik:RadEditor> </td> </tr> <tr><td style="height:30px;"></td></tr> <tr> <td style="text-align:center; font-weight:bold; text-align:center;">Texto Medio</td> </tr> <tr> <td style="vertical-align:top;"> <telerik:RadEditor Language="es-ES" LocalizationPath="~/App_GlobalResources/" id="txtTextoMedio" runat="server" SkinID="DefaultSetOfTools" EditModes="Design" Skin="Sunset" ToolsFile="~/EditorOpcionesBasicas.xml" OnClientLoad="LimitCharactersM" OnClientPasteHtml="OnClientPasteHtmlM" Height="190"> </telerik:RadEditor> </td> </tr> <tr><td style="height:30px;"></td></tr> <tr> <td style="text-align:center; font-weight:bold; text-align:center;">Texto Largo</td> </tr> <tr> <td style="vertical-align:top;"> <telerik:RadEditor Language="es-ES" LocalizationPath="~/App_GlobalResources/" id="txtTextoLargo" runat="server" SkinID="DefaultSetOfTools" EditModes="Design" Skin="Sunset" ToolsFile="~/EditorOpcionesBasicas.xml" Height="300"> </telerik:RadEditor> </td> </tr></table>This WebUserControl contains a function that saves the text to a database:
public bool GuardarTextos(string pIdACP, out string pError) { pError = ""; return mLN.GuardarTextosACP(pIdACP, txtTextoCorto.Content.Trim(), txtTextoMedio.Content.Trim(), txtTextoLargo.Content.Trim(), out pError); }Here, for all the RadEditors (txtTextoCorto, txtTextoMedio and txtTextoLargo) always the Content property and Text property is empty.
I show the WebUserControl in an asp ModalPopupExtender and I call the GuardarTextos function from an external button.
Can you help me what I'm doing wrong?
Thank you very much.