Hi,
How can I bind a keyup event on a GridTextBoxColumnEditor.
I tried this, but the keyup event never fired:
RadGrid
Javascript:
Thank you
Steeve
How can I bind a keyup event on a GridTextBoxColumnEditor.
I tried this, but the keyup event never fired:
RadGrid
<
ClientEvents
OnBatchEditOpening
=
"onBatchEditOpening"
OnBatchEditOpened
=
"onBatchEditOpened"
></
ClientEvents
>
<!-- Column -->
<
telerik:GridBoundColumn
UniqueName
=
"Comments"
ColumnEditorID
=
"GridTextBoxEditComments"
HeaderText="<%$Resources:FsActivityService,Comments%>" DataField="Comments" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" AllowFiltering="false" ></
telerik:GridBoundColumn
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxEditComments"
runat
=
"server"
TextBoxMaxLength
=
"255"
TextBoxMode
=
"MultiLine"
>
<
TextBoxStyle
Width
=
"100%"
/>
</
telerik:GridTextBoxColumnEditor
>
Javascript:
function
onBatchEditOpened(sender, args) {
var
cell = args.get_cell();
var
textArea = cell.getElementsByTagName(
"textarea"
)[0];
var
textAreaId = textArea.id;
if
(cell.style.backgroundColor ==
"lightgray"
|| cell.style.backgroundColor ==
"lightgrey"
)
textArea.value =
""
;
$(
'#'
+ textAreaId).css(
'overflow'
,
'hidden'
);
$(
'#'
+ textAreaId).addClass(
'textareaComments'
);
$(
'#'
+ textAreaId).unbind(
'keyup'
).bind(
'keyup'
,
function
(evt)
{
checkTextAreaMaxLength(textArea, evt, 255);
});
textAreaAdjust(textArea);
}
function
textAreaAdjust(o) {
o.style.height =
"1px"
;
o.style.height = (o.scrollHeight)+
"px"
;
}
function
checkTextAreaMaxLength(textBox,e, length) {
alert(
'check length'
);
}
Thank you
Steeve