null returns when getting the radtextbox on clientscript

3 posts, 0 answers
  1. Arputharaj
    Arputharaj avatar
    11 posts
    Member since:
    Mar 2009

    Posted 26 Mar 2009 Link to this post

    I called the below function using the registerstartupscript block, but the alert returns null, so i couldnot read the object..
    please help me to get out from this   

    function State_Onload()
        {
        var CurrCode = $find("<%= txtCountry.ClientID%>");
        var state = $find("<%= txtStPrTe.ClientID%>");   
        var objStatelkp = document.getElementById("<%= imgSPTlookup.ClientID%>");  
        
        alert(CurrCode);
        alert(state);
        alert(objStatelkp);
        
        var cCode =  CurrCode.get_value();
        
            if (cCode == null)
            {
                            objStatelkp.style.display = 'none';
                            state.disable();       
            }
                        else if (cCode == 'US' || cCode == 'CA' || cCode == 'PR')
                        {
                            objStatelkp.style.display = 'block';
                            state.disable();
                        }
                        else
                        {
                            objStatelkp.style.display = 'none';
                            state.enable();
                        }
        }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2009 Link to this post

    Hi Arputharaj,

    Can you try following code snippet for calling the client side function and check whether this is working as expected?

    CS:
    protected void Button2_Click(object sender, EventArgs e) 
        string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(State_Onload);</script>"
        ClientScript.RegisterStartupScript(this.GetType(), "State_Onload", script);   

    Thanks,
    Shinu.
  3. Arputharaj
    Arputharaj avatar
    11 posts
    Member since:
    Mar 2009

    Posted 26 Mar 2009 Link to this post

    Thanks for your valuable comments shinu. But I tried that only, the html image control (which is the thrid object in the alert list) alone returns the object, but the remaing tow radtextboxes returns null.
Back to Top