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

NumericTextBox 'null' is null or not an object

3 Answers 103 Views
Input
This is a migrated thread and some comments may be shown as answers.
Gilberto Anino
Top achievements
Rank 1
Gilberto Anino asked on 08 Jun 2010, 09:22 PM
Hi, I'm trying to get a numerictextbox from client. I always get the message "Microsoft JScript runtime error: 'null' is null or not an object"

My JAVASCRIPT
<div id="Div1" runat="server"
<script language="javascript" type="text/javascript"
 
function Itinerario()  
     
     var CUENTAS = $find('<%=TxtNroCtas.ClientID%>');  
     
    if (document.getElementById('RBTipoItinerario_0').checked==true
    { 
        div = document.getElementById('HORARIOS'); 
        div.style.display=''
        CUENTAS.set_visible(false); 
         
    } 
     
    if ( document.getElementById('RBTipoItinerario_1').checked==true
    { 
        div = document.getElementById('HORARIOS'); 
        div.style.display='none'
        CUENTAS.set_visible(true); 
    } 
    
 
 
</script> 
</div> 


My INPUT
<telerik:RadNumericTextBox ID="TxtNroCtas" Runat="server" Skin="Office2007"
   <NumberFormat DecimalDigits="0" GroupSeparator="" /> 
</telerik:RadNumericTextBox> 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Jun 2010, 09:20 AM
Hi Gilberto,

The above code worked fine for me.

How are you calling the client function 'Itinerario()'? I guess you are invoking the function from code behind, if so you need to add a Sys.Application.Load handler, which is to ensure calling event only after rendering the control on page.

C#:
 
ScriptManager.RegisterStartupScript(thisthis.GetType(), "inlinesetfocus""function f() { Itinerario(); Sys.Application.remove_load(f);} Sys.Application.add_load(f); "true); 


Could you provide some more information about calling the method, if this does not help?

Regards,
Princy.
0
Gilberto Anino
Top achievements
Rank 1
answered on 09 Jun 2010, 02:18 PM
Well, I add an attribute to my control in my Load Page event .... I have a RadioButtonList on my page and I want to execute de script when the user choose an item of it. The rest of the script works fine... my only problem is when I try to hide de numericTextBox.

CODE

 protected void Page_Load(object sender, EventArgs e) 
    { 
         
        this.RBTipoItinerario.Attributes.Add("onclick""Itinerario();"); 
     }    

Thanks for helping me and sorry for my bad english!!!
0
Dimo
Telerik team
answered on 10 Jun 2010, 02:32 PM
Hi Gilberto,

I don't see anything wrong with your code. If you need further assistance, please send a complete runnable page.

Greetings,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Input
Asked by
Gilberto Anino
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gilberto Anino
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or