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

Telerik controls are unavailable to javascript when the page's startup script runs

3 Answers 91 Views
Input
This is a migrated thread and some comments may be shown as answers.
Raju Kumar
Top achievements
Rank 1
Raju Kumar asked on 30 May 2008, 11:16 AM
Hi,
  Telerik controls are unavailable to javascript when the page's startup script runs

i am doing it like

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "CalTableMatrix", "<script>AddValue();</script>");


and in javascript

function AddValue()

{

$find(MASTERPAGECONTROLID + Ids[i]).set_value(TotVal);

}

It is returning null for the control.

But, when i call this javascript method on any event like on a click of a button it is working fine.

So, can you please suggest me the way to execute this javascript function by registering as page's startup script .

Thanks.
Raju.

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 30 May 2008, 01:23 PM
Hi Raju,

A Microsoft ASP.NET AJAX page raises the same server life-cycle events as an ASP.NET Web page and also raises client life-cycle events. The client events also help you manage custom script components during the lifetime of the page in the browser. The client events are raised by classes in the Microsoft AJAX Library. These classes and components are automatically instantiated before pageInit client-side event


For more information refer to the following link:
http://www.asp.net/ajax/documentation/live/overview/AJAXClientEvents.aspx


Best wishes,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Edwin
Top achievements
Rank 1
answered on 21 Jan 2009, 04:51 AM
Hi Plamen

Can you show an example to demonstrate how to "find" a client side RadInputControl object when a page is loaded?

Thanks in advance
Edwin
0
Shinu
Top achievements
Rank 2
answered on 21 Jan 2009, 06:44 AM
Hi Edwin,

In order to get the client side object of RadControls, you can create function that use the reserved name pageLoad (which fires when page loads) and inside that you can access the client side object for each control. The following example shows how to add a handler for the load event for getting the object by using this approach.

JavaScript:
<script type="text/javascript"
function get_object() 
    var input = $find("<%= RadTextBox1.ClientID %>"); // Getting the client-side object 
function pageLoad(sender, args) 
    get_object(); 
</script> 

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