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

RadTextBox in Template not referenced in client side

1 Answer 27 Views
Input
This is a migrated thread and some comments may be shown as answers.
Li Zhou
Top achievements
Rank 1
Li Zhou asked on 15 Jun 2010, 06:35 AM
I have a RadTextBox in a CreateUserWizard template.  I tried to use following code to reference it in client side:

var tb = $find("<%= UserName.ClientID %>"); 
But I always get null.

Is there any way to reference the RadTextbox in javascript?

Here is the code in the page:
<asp:CreateUserWizard ID="C" runat="server">
        <WizardSteps>
            <asp:CreateUserWizardStep ID="Step1" runat="server">
                <contenttemplate>
                    <telerik:RadTextbox ID="UserName" Label="Username:" runat="server" MaxLength="15" />
                     ........
                </contenttemplate>
            </asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 15 Jun 2010, 09:48 AM
Hi,

I hope the following idea will work for you.

aspx:
 
    <telerik:RadTextBox ID="UserName" Label="Username:" runat="server" MaxLength="15"
        <ClientEvents OnLoad="OnLoad" /> 
    </telerik:RadTextBox> 


javascript:
 
<script type="text/javascript"
    var textboxUserName; 
    function OnLoad(sender, args) { 
        textboxUserName = sender; 
    } 
    // 'textboxUserName' is client object of the RadTextBox UserName 
</script> 


-Shinu.
Tags
Input
Asked by
Li Zhou
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or