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

$find returns null

1 Answer 171 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ketaki Indurkar
Top achievements
Rank 1
Ketaki Indurkar asked on 24 Sep 2010, 07:12 AM
Hi,

I am trying to invoke a javascript function on the Pageload event and get the object of the comboox in that function. But the $find returns me a null. 
Here is my page load method in .cs file

protected void Page_Load(object sender, EventArgs e)
{
Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ResponseScripts.Add("SaveOriginalValues();");
}

This is my javascript function
function SaveOriginalValues()
    {
       var cmb1 = $find('<%= cmb1.ClientID %>');
       var selectedItem = cmbHealthPlan.get_selectedItem();
       
    }

 cmb1 has a null value when I execute this. 
Could anyone please help? 

Thanks & Regards,
Ketaki


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Sep 2010, 07:42 AM
Hello,


Try the client-side pageLoad() method to get the client object of ajax-enabled controls.

Client-side:
<script type="text/javascript">
function pageLoad()
    var cmb1 = $find('<%= cmb1.ClientID %>');
}
</script>



-Shinu.
Tags
ComboBox
Asked by
Ketaki Indurkar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or