Hello, I have a grid (gridEdit) where I am trying to attach a client side handler to certain auto generated edit elements. I seem to have a valid reference and no errors are being thrown, but the handler never gets called.
Code behind:
Javascript:
Code behind:
protected
void
gridEdit_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem form = (GridEditableItem)e.Item;
for
(
int
i = 0; i < _charFieldLength.Count; i++)
{
TextBox dataField = (TextBox)form[_charFieldLength[i].FieldName].Controls[0];
dataField.MaxLength = _charFieldLength[i].DataLength;
}
for
(
int
j = 0; j < form.Controls.Count; j++)
{
try
{
if
(form.Controls[j].Controls[0]
is
RadNumericTextBox)
{
RadNumericTextBox rnt = (RadNumericTextBox)form.Controls[j].Controls[0];
rnt.ClientEvents.OnKeyPress =
"NumericOnKeyPress"
;
}
}
catch
(Exception ex) { }
}
}
}
Javascript:
function
NumericOnKeyPress( sender, args )
{
alert(
'In KeyPressHandler'
);
}