This is a migrated thread and some comments may be shown as answers.

Timepicker objtec has null with Javascript

1 Answer 45 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Amendra
Top achievements
Rank 1
Amendra asked on 24 Feb 2009, 04:42 AM

Hi

I am using the following to pass some values to a javascript function on the RadTimepickers onkeypress event. But unfortunatly the object.Value seems to be undefined.

ASPX
This is inside a Grids footer.
                                            <FooterTemplate>
                                                <telerik:RadTimePicker ID="footerRadInsStartTime" runat="server" Onkeypress="return validatenumber(event, this, 'int');">
                                                </telerik:RadTimePicker>
                                            </FooterTemplate>


function validatenumber(event, obj, type)
{

            var code = (event.which) ? event.which : event.keyCode;
            var character = String.fromCharCode(code);  

            var afterDecimal = obj.value.indexOf('.');     // This is where it has the null value
blah blah
...
....
}

obj.value is always null. Any help to overcome. I cannot use $find because the control is inside the Grid.


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Feb 2009, 07:58 AM
Hi Amendra,

Try with the OnKeyPress client event of the DateInput and see whether it is working.

ASPX:
<telerik:RadTimePicker ID="RadTimePicker1"  runat="server"
        <DateInput  ClientEvents-OnKeyPress="OnKeyPress" ></DateInput
        </telerik:RadTimePicker> 

JS:
<script type="text/javascript"  > 
 
function OnKeyPress(sender, eventArgs) 
  var code = eventArgs.get_keyCode(); 
 
 
</script> 

You can also go through the following help article which explains how to access template controls on the client side.
Accessing server controls in a grid template on the client

Shinu



Tags
Calendar
Asked by
Amendra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or