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

Problem when adding event handler at client side

1 Answer 94 Views
Input
This is a migrated thread and some comments may be shown as answers.
Edwin
Top achievements
Rank 1
Edwin asked on 21 Jan 2009, 06:40 AM
I need to add event handler at client side to a RadDateInput control.

string script =   
string.Format("$find('{0}').add_valueChanged({1});", myDateInput.ClientID, myHandlerFunction);  
 
ScriptManager.RegisterStartupScript(  
    this, typeof(DateInput), "clientChange",  
    script,  
    true); 

The above javascript can be fired when the page is loaded but $find cannot find the control.  However the script can be executed successfully after the page is completely loaded.

Where should I "call" my javascript if not using RegisterStartupScript?

Best regards
Edwin

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Jan 2009, 07:11 AM
Hi Edwin,

One suggestion is by using the pageLoad event on client side in order to access the RadControl client ide object when page loads. Please try the JavaScrip code below and see whether it fits your need.

JavaScrip:
<script type="text/javascript"
function get_DateInput() 
    var input = $find("<%= RadDateInput1.ClientID %>"); 
function pageLoad(sender, args) 
    get_DateInput(); 
</script> 

Thanks,
Shinu.
Tags
Input
Asked by
Edwin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or