Binding Java Script Event To ASP.NET Control In C#

This blogs helps you to understand the concept of Binding Java Script event to control in C#. Binding javascript event to an control in code behild (C#) code is follows,
  1. Asp.net_control.Attributes.Add("Key""Value");     
Key  - java script events for control
Value - Java script  functions
Example code snippet
  1. Asp.net_control.Attributes.Add("onKeyPress""javascript:return OnEnterKey(event,this)");   
  4.            Asp.netControl.Attributes.Add("readonly""readonly");  
  5.            Asp.netControl.Attributes.Add("readonly""readonly");  
With the above mentioned code, controls are, textbox, datagrid, dropdown, label etc
Key - OnkeyPress, readonly, onclick
Value - OnClick, Onenterkey, etc -  Mention java script function name. 
With the above mentioned code, we can bind javascript to any control in C#; it depends on the required time.