RadTextBox Client not render correctly

4 posts, 0 answers
  1. Vincent
    Vincent avatar
    70 posts
    Member since:
    Jul 2008

    Posted 03 Apr 2010 Link to this post

    Can someone tell me Is it a bug or something else? In the picture, the top value is just output by response.write(radtextbox.ClientID) which is different to ie rendered clientid
  2. Dimo
    Admin
    Dimo avatar
    8485 posts

    Posted 05 Apr 2010 Link to this post

    Hello Vincent,

    RadTextBox renders several <input> elements. The control's client ID is applied to the next <input> in the HTML, which is also seen on your screenshot.

    someID - this is the ID of the <input> which holds the control's actual value and the client control instance

    someID_text - this is the ID of the <input> which accepts the user input

    Rendering several <input> elements is required in order to support all features of RadTextBox (and the other RadInput textbox types)

    Greetings,
    Dimo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Vincent
    Vincent avatar
    70 posts
    Member since:
    Jul 2008

    Posted 05 Apr 2010 Link to this post

    Thanks for your reply.

    Well, that's make sense. But I have a problem when I am trying to access the value of the radtextbox from javascript after postback.. Refer to that screenshot I posted. After I do a postback and use the $find to get radtextbox object, it always return null.

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> 
     
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">  
    </asp:Content> 
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
     
    <script type="text/javascript">  
        var o = $find("<%=RadTextBox1.ClientID %>");  
        alert(o);  
        alert("<%=RadTextBox1.ClientID %>");  
        if (o != null)  
            alert(o.InnerHtml);  
          
    </script> 
     
        <telerik:RadTextBox ID="RadTextBox1" runat="server">  
        </telerik:RadTextBox> 
        <telerik:RadNumericTextBox ID="txtNum" runat="server">  
        </telerik:RadNumericTextBox> 
        <asp:Button runat="server" ID="cmd" Text="PostBack" /> 
          
    </asp:Content> 
     
  4. Dimo
    Admin
    Dimo avatar
    8485 posts

    Posted 06 Apr 2010 Link to this post

    Hi Vincent,

    The $find statement is outside any function, which means that it will be executed as soon as the Javascript is parsed by the browser. This is too early, because the AJAX controls' client instances have not been initialized yet. Please refer to the following blog post to find out how to execute Javascript with $find() statements as soon as possible (Sys.Application.add_load() )

    http://blogs.telerik.com/dimodimov/posts/08-12-13/don_t_use_body_onload_in_asp_net_ajax_websites.aspx

    All the best,
    Dimo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top