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

RadTextBox Client not render correctly

3 Answers 59 Views
Input
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 03 Apr 2010, 09:43 AM
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

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 05 Apr 2010, 10:21 AM
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.
0
Vincent
Top achievements
Rank 1
answered on 05 Apr 2010, 11:36 AM

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> 
 
0
Dimo
Telerik team
answered on 06 Apr 2010, 01:35 PM
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.
Tags
Input
Asked by
Vincent
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Vincent
Top achievements
Rank 1
Share this question
or