Skip to content
Loading
Adding a Javascript function from code-behind in Page_Load()
  • Jignesh Kumar
    Please first remove both line and try below line, it should work I have tried its working
  • No, I just uncommented it for example purpose.  I even changed the case to lowercase in the TextBox1_TextChanged event, it still does not work.
  • Jignesh Kumar
    Hi Cally,
     
    Javascript is Casesensitive please change event name like below
     
    1. TextBox1.Attributes.Add("onkeydown""alert('Hello')");    
     
  • Salman Beg
    Hey Hi. We can add JavaScript function from client side also and it is not required to add from code behind. The second onkeydown event don't fire because you already added onkeydown event in the pageload itself. Thanks.