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

$find radtextbox null

3 Answers 186 Views
Input
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 04 Sep 2009, 06:07 AM

Hi,

I can't seem to reference my textbox from my javascript.

on the aspx:

        <asp:ScriptManager ID="ScriptManager1" runat="server"  EnablePartialRendering="True" EnablePageMethods="True">  
            <Scripts> 
                <asp:ScriptReference Path="scripts.js" /> 
            </Scripts> 
        </asp:ScriptManager> 
          
          
        <table cellpadding="0" cellspacing="0">  
            <tr> 
                <td width="80%">  
<%--                            <asp:textbox runat="server" TextMode="MultiLine" id="txt" style="WIDTH: 690px; HEIGHT: 260px" rows="16" Columns="79" ></asp:textbox>&nbsp;  
--%>                    <telerik:RadTextBox ID="txt" Width="690" Height="260" Rows = "16" Columns = "79" runat="server" TextMode="MultiLine" SelectionOnFocus="CaretToEnd"></telerik:RadTextBox><br /> 
                   <asp:TextBox id="txtMsg" Width="400" Runat="server"></asp:TextBox>&nbsp;&nbsp; <input id="btn" onclick="button_clicked()" type="button" value="SEND" class="btn"/>  
                </td> 

script:

            function button_clicked()  
            {  
                var RadTextBox = $find("<%= txt.ClientID %>");  
                if (RadTextBox == null) {  
                    var b = bla;  
                }  
                PageMethods.SendMessage($get("txtMsg").value,$get("hdnRoomID").value,UpdateMessages, errorCallback);  
                $get("txtMsg").value="";  
                $get("txt").scrollIntoView("true");  
            } 

RadTextBox is null..

Any idea what I did wrong?

Thanks,

Andreas

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 04 Sep 2009, 02:05 PM
Hi Andreas,

Please review the following article for more information about how to get RadTextBox value: Getting and Setting Values and let me know if you continue to experience difficulties.

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andreas
Top achievements
Rank 1
answered on 04 Sep 2009, 03:35 PM
hello,

I did follow that.. and it was returning null, that's why I ask here.

I'm wondering what I did wrong? Because I couldn't see anything suspicious.

Does this always work when RadTextBox inside table cell , update panel, etc?

Thanks,

Andreas
0
Pavlina
Telerik team
answered on 04 Sep 2009, 04:18 PM
Hello Andreas,

I followed your scenario in order to replicate the issue but to no avail. Please find attached a simple runnable project that demonstrates the desired functionality. Give it a try and let me know if I am leaving something out.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Andreas
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Andreas
Top achievements
Rank 1
Share this question
or