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

null returns when getting the radtextbox on clientscript

2 Answers 105 Views
Input
This is a migrated thread and some comments may be shown as answers.
Arputharaj
Top achievements
Rank 1
Arputharaj asked on 26 Mar 2009, 05:34 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Mar 2009, 07:52 AM
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.
0
Arputharaj
Top achievements
Rank 1
answered on 26 Mar 2009, 09:14 AM
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.
Tags
Input
Asked by
Arputharaj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arputharaj
Top achievements
Rank 1
Share this question
or