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

Accessing a radcombobox on the windows.onloadHi I am trying to access the dropdown from javascript event window.onload

2 Answers 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
IrishManInUSA
Top achievements
Rank 1
IrishManInUSA asked on 01 Jul 2010, 04:27 PM
I am trying to access the radcombobox on my page from javascript, when the page is finished loading, using javascript and when I make a reference to the control using the following:

var radDdlGraphics = $find('radDdlGraphics');

It comes back as being null, which is weird, because I try to change a value within dropdown on the page itself. It fires the onchange event and references the object the same way.

Any ideas on why this doesn't work in the window.onload and yet works when the page is loaded, I would have thought they work the same way, but that is not the case.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 02 Jul 2010, 06:25 AM
Hello,

In ASP.NET AJAX environment, the ASP.NET AJAX controls (including RadControls for ASP.NET AJAX) are created after the page has been loaded. The problem here is that when you initially try to get a reference to the RadControl where the control is still not fully rendered on the page.

Try the pageLoad() function to access the client object of the control instead of using window.onload. The function pageLoad() is fired automatically by the MS AJAX client framework when the page is rendered completely. Try the code below and see whether it is working for you.

 
<script language="javascript" type="text/javascript">  
function pageLoad()  
{  
    // your code to access RadControls 
}  
</script>  


Regards,
Shinu.
0
IrishManInUSA
Top achievements
Rank 1
answered on 02 Jul 2010, 03:27 PM
thank you very much for your help.
Tags
ComboBox
Asked by
IrishManInUSA
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
IrishManInUSA
Top achievements
Rank 1
Share this question
or