$find returns null

2 posts, 0 answers
  1. Ketaki Indurkar
    Ketaki Indurkar avatar
    14 posts
    Member since:
    Mar 2010

    Posted 24 Sep 2010 Link to this post

    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


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Sep 2010 Link to this post

    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.
Back to Top