

<
telerik:RadEditor ID="EdtDesc" runat="server" SkinID="radEditor1Skin" OnClientLoad="LimitCharacters"
OnClientPasteHtml="OnClientPasteHtml">
</telerik:RadEditor>
<script type="text/javascript">
var editorList = new Object();
var editorLengthArray = [30, 30];
var counter = 0;
function isAlphaNumericKey(keyCode) {
if ((keyCode > 47 && keyCode < 58) || (keyCode > 64 && keyCode < 91)) {
return true;
}
return false;
}
function LimitCharacters(editor) {
editorList[editor.get_id()] = editorLengthArray[counter];
counter++;
editor.attachEventHandler(
"onkeydown", function(e) {
e = (e ==
null) ? window.event : e;
if (isAlphaNumericKey(e.keyCode)) {
var maxTextLength = editorList[editor.get_id()];
textLength = editor.get_text().trim().length;
if (textLength >= maxTextLength) {
alert(
'You are not able to type more than ' + maxTextLength + ' symbols!');
var rtfeditor = $find("<%=EdtDesc.ClientID %>");
var oValue = rtfeditor.get_text().trim();
rtfEditor.set_text(oValue.substring(0, 30));
e.returnValue =
false;
}
}
});
var element = document.all ? editor.get_document().body : editor.get_document();
$telerik.addExternalHandler(element,
"paste", function(e) {
e = (e ==
null) ? window.event : e;
var maxTextLength = editorList[editor.get_id()];
textLength = editor.get_text().length;
var clipboardLength = window.clipboardData.getData("Text").length;
textLength += clipboardLength;
if (textLength >= maxTextLength) {
alert(
'You are not able to type more than ' + maxTextLength + ' symbols!');
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 maxTextLength = editorList[editor.get_id()];
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(
'You are not able to type more than ' + maxTextLength + ' symbols!');
args.set_cancel(
true);
}
}
}
</script>

I believe a bug exists when using a GridDateTimeColumn DataType="System.TimeSpan" PickerType="TimePicker" DataFormatString="{0:t}" and then attempting UpdateValues in the code behind. UpdateValues fails because the value returning is DateTime instead of TimeSpan.
<telerik:GridDateTimeColumn DataType="System.TimeSpan" PickerType="TimePicker" DataFormatString="{0:t}" EditFormColumnIndex="2" HeaderText="End Time" DataField="TimeEnd" UniqueName="TimeEnd" />
void RadGrid_UpdateCommand(object source, GridCommandEventArgs e)
{
var editableItem = ((GridEditableItem)e.Item);
var id = (long)editableItem.GetDataKeyValue("Id");
using (DataContext context = new DataContext())
{
var frequencyLocation = context.FrequencyLocation.ByKey(id);
if (frequencyLocation != null)
{
editableItem.UpdateValues(frequencyLocation);
context.SubmitChanges();
}
}
}

| function HideAllCalendars() |
| { |
| if( typeof(jQuery) != 'undefined' ) |
| { |
| jQuery("div.RadCalendar").each(function() { |
| if (this) |
| { |
| // find first INPUT child node |
| var obj = null; |
| for( var i = 0; i < this.childNodes.length; i++ ) |
| { |
| var node = this.childNodes[ i ]; |
| if( node.tagName == 'INPUT' && node.id ) |
| { |
| obj = node; |
| break; |
| } |
| } |
| if( obj ) |
| { |
| var oo = $find(obj.id) |
| if(oo && oo.hidePopup && oo.hideTimePopup) |
| { |
| oo.hidePopup(); |
| oo.hideTimePopup(); |
| } |
| } |
| } |
| }); |
| } |
| } |
| for(var _32 in Telerik.Web.UI.RadDatePicker.PopupInstances){ |
| if(Telerik.Web.UI.RadDatePicker.PopupInstances.hasOwnProperty(_32)){ |
| var _33=Telerik.Web.UI.RadDatePicker.PopupInstances[_32].Opener; |
| this._hideFastNavigationPopup(_33); |
| Telerik.Web.UI.RadDatePicker.PopupInstances[_32].Hide(); |
| } |
| } |
| },_hideFastNavigationPopup:function(_34){ |
| if(_34){ |
| var _35=_34.get_calendar()._getFastNavigation().Popup; //Error Happens here! |
| if(_35&&_35.IsVisible()){ |
| _35.Hide(true); |
| } |
| } |
| },_setInputDate:function(_36){ |
| this._dateInput.set_selectedDate(_36); |
| },_getJavaScriptDate:function(_37){ |
| var _38=new Date(); |
| _38.setFullYear(_37[0],_37[1]-1,_37[2]); |
<script type="text/javascript">
var editorList = new Object();
var editorLengthArray = [30, 30];
var counter = 0;
function isAlphaNumericKey(keyCode) {
if ((keyCode > 47 && keyCode < 58) || (keyCode > 64 && keyCode < 91)) {
return true;
}
return false;
}
function LimitCharacters(editor) {
editorList[editor.get_id()] = editorLengthArray[counter];
counter++;
editor.attachEventHandler("onkeydown", function(e) {
e = (e == null) ? window.event : e;
if (isAlphaNumericKey(e.keyCode)) {
var maxTextLength = editorList[editor.get_id()];
textLength = editor.get_text().trim().length;
if (textLength >= maxTextLength) {
alert('You are not able to type more than ' + maxTextLength + ' symbols!');
var rtfeditor = $find("<%=EdtDesc.ClientID %>");
var oValue = rtfeditor.get_text().trim();
rtfEditor.set_text(oValue.substring(0, 30));
e.returnValue = false;
}
}
});
var element = document.all ? editor.get_document().body : editor.get_document();
$telerik.addExternalHandler(element, "paste", function(e) {
e = (e == null) ? window.event : e;
var maxTextLength = editorList[editor.get_id()];
textLength = editor.get_text().length;
var clipboardLength = window.clipboardData.getData("Text").length;
textLength += clipboardLength;
if (textLength >= maxTextLength) {
alert('You are not able to type more than ' + maxTextLength + ' symbols!');
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 maxTextLength = editorList[editor.get_id()];
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('You are not able to type more than ' + maxTextLength + ' symbols!');
args.set_cancel(true);
}
}
}
</script>