$find radtextbox null

4 posts, 0 answers
  1. Andreas
    Andreas avatar
    8 posts
    Member since:
    Nov 2008

    Posted 04 Sep 2009 Link to this post

    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
  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 04 Sep 2009 Link to this post

    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.
  3. Andreas
    Andreas avatar
    8 posts
    Member since:
    Nov 2008

    Posted 04 Sep 2009 Link to this post

    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
  4. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 04 Sep 2009 Link to this post

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