RadTextBox postback not firing after tabbing off

2 posts, 0 answers
  1. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 22 Jun 2013 Link to this post

    Hello friends,

    I am using a RadTextBox, laying on a RadWindow and I want to make an ajax request from that control when the OnTextChange event is triggered. I am trying to use the following :
    ScriptManager : This is the content page and the master page has got a script manager as below:
    • <body>
          <form id="form1" runat="server">
          <telerik:RadScriptManager ID="scriptSchMaster" runat="server" EnablePartialRendering="true"
              EnableScriptCombine="true" OnAsyncPostBackError="scriptSchMaster_AsyncPostBackError">
                  <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                  <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                  <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
          <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
          <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
          <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
                  <telerik:TargetControl ControlsToApplySkin="<Rad Controls>" Skin="<some valid skin name>" />
                  <telerik:TargetControl ControlsToApplySkin="<Rad Controls>" Skin="<some valid skin name>" />
    .aspx code snippet

    <label>Product #</label><br />
    <telerik:RadTextBox ID="tbProductNumber" runat="server" Width="250" CssClass="upperCase"
            AutoPostBack="true" MaxLength="30" OnTextChanged="tbProductNumber_OnTextChanged"
            EmptyMessage="Required" EnableViewState="true"
                <ClientEvents OnBlur="jsfun_tbProductOnBlur" />
    <asp:UpdatePanel ID="upCheckProductNumber" runat="server" UpdateMode="Always">
            <asp:Label ID="lblCheckProductResult" runat="server"></asp:Label>
            <asp:AsyncPostBackTrigger ControlID="tbProductNumber" EventName="TextChanged" />
    </asp:UpdatePanel><br />
    <label id="lblProductNumValidator"></label>

    .js code

    function jsfun_tbProductNumberOnBlur(sender, args) {
        elem_ProductNumber = $find('<%=tbProductNumber.ClientID %>');
        if (
                elem_ProductNumber.get_value() != null &&
                elem_ProductNumber.get_value() != undefined
                    ProductNoEmpty = false;
                    ProductNoEmpty = true;
                //__doPostBack('', '');

    .aspx.cs code snippet: (This is not being called)

    protected void tbProductNumber_OnTextChanged(object sender, EventArgs e)
            lblCheckProductNumberResult.Text = "Hello Ajax!";

    I tried something in a separate sample application and it seemed to be working for textbox and radtextbox, both ...

    .aspx content page

    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <asp:ScriptManager runat="server">
        <br />
        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="txtChanged"></asp:TextBox>
        <telerik:RadTextBox ID="radTextBox1" runat="server" AutoPostBack="true" OnTextChanged="txtChanged">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <asp:AsyncPostBackTrigger ControlID="TextBox1" EventName="TextChanged" />
                <asp:AsyncPostBackTrigger ControlID="radTextBox1" EventName="TextChanged" />
        <br />
        <input id="Text1" type="text" /><br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />

    code behind
    public partial class WebForm1 : System.Web.UI.Page
            protected void Page_Load(object senderEventArgs e)
            protected void txtChanged(object senderEventArgs e)
                Label1.Text = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");

    Any help 'd be appreciated ...

  2. Vasil
    Vasil avatar
    1604 posts

    Posted 25 Jun 2013 Link to this post

    Hi Aarsh,

    I have examined your code and spotted that the JavaScript event handler that you are trying to use has different than the declarated one.
    <ClientEvents OnBlur="jsfun_tbProductOnBlur" />

    function jsfun_tbProductNumberOnBlur(sender, args) {

    This will result in JavaScript exception and the Ajax Callback will not happen.

    I suppose it could be a copy-paste error during your posting so please confirm that you have enabled Script Debugging in your browser and there is no JavaScript error if this is not the source of the problem.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top