EmptyMessage disappears on Ajax Postback

4 posts, 0 answers
  1. Paul J
    Paul J avatar
    101 posts
    Member since:
    Nov 2008

    Posted 12 Aug 2011 Link to this post

    I've got 3 textboxes and an InputManager that sets the EmptyMessages of these textboxes. On initial page load, the empty messages are displayed fine, however on an Ajax postback of a radcombobox, these empty messages disappear and leave the textboxes blank.

    Why is this happening? Thanks.
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 16 Aug 2011 Link to this post

    Hello Paul,

    Can you send us the mentioned controls declaration as well as the RadAjaxManager settings so we can replicate the issue on our side and see what went wrong there?

    Regards,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Paul J
    Paul J avatar
    101 posts
    Member since:
    Nov 2008

    Posted 16 Aug 2011 Link to this post

    I just realized what it was. I did not have the RadInputManager1 as an AjaxUpdatedControl for the RadComboBox1. I guess it did not dawn on me that I'd need to do that. I guess I thought if the boxes had an empty message after initial page load, they would retain it automatically on ajax postback, but obviously that is not the case.

    I still do have one issue, that being while the empty message are now showing up, they actually first disappear when the ajax postback begins and do not show back up until the postback finishes. Is there code that I can use to adjust this, so that the empty messages do not ever disappear?

    here's my full testing code:

    page:
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="5000">
                           <Scripts>
                                <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" />
                             </Scripts>
                    </telerik:RadScriptManager>
              <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager>
        <div>
        <asp:Panel ID="pnl1" runat="server" width="100%">
       <telerik:RadInputManager ID="RadInputManager1" runat="server">
            <telerik:TextBoxSetting BehaviorID="TextBoxBehavior1" EmptyMessage="Comment 1"  Validation-IsRequired="false" InitializeOnClient="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="Comment1" />
                </TargetControls>
            </telerik:TextBoxSetting>
                    <telerik:TextBoxSetting BehaviorID="TextBoxBehavior2" EmptyMessage="Comment 2"  Validation-IsRequired="false" InitializeOnClient="true" >
                <TargetControls>
                    <telerik:TargetInput ControlID="Comment2" />
                </TargetControls>
            </telerik:TextBoxSetting>
                    </telerik:RadInputManager>
      
    <table>
    <tr>
      <td><telerik:RadComboBox ID="RadComboBox1" CollapseAnimation-Type="None" BackColor="white" ExpandAnimation-Type="none" AllowCustomText="true" MarkFirstMatch="true" runat="server" EmptyMessage="" TabIndex="8" Skin="Office2010Silver" AutoPostBack="true"
                      HighlightTemplatedItems="true" height="200px" Width="150px" DropDownWidth="280px" EnableLoadOnDemand="true">
                    <Items>
                    <telerik:RadComboBoxItem Value="1" Text="one" />
                    <telerik:RadComboBoxItem Value="2" Text="two" />
                    </Items>
                            <CollapseAnimation Type="None" />
                        <ExpandAnimation Type="None" />
                        </telerik:RadComboBox>
             </td>
     <td style="min-height:18px;"><asp:Label ID="Label1" runat="server"  /></td>
     <td><asp:TextBox ID="Comment1" TabIndex="13" width="160px" MaxLength="30" runat="server"></asp:TextBox>
                </td>
              <td><asp:TextBox ID="Comment2" TabIndex="14" width="160px" MaxLength="30" runat="server"></asp:TextBox>
              </td>
      
    </tr>
    </table>
      
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Label1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
             </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
           
    </asp:Panel>
        </div>
        </form>
    </body>
    </html>


    codebehind:
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    Private Sub RadComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
        Label1.Text = RadComboBox1.SelectedItem.Text
        'force slight delay
        System.Threading.Thread.Sleep(2000)
    End Sub

  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 18 Aug 2011 Link to this post

    Hello Paul,

    Thank you for the sample code. I tested it and was able to replicate the issue.
    Basically, you do not need to set the RadInputManager as updated control except some of the textboxes it inputifies is set as such. However it seems that this is the only workaround now.
    I have logged the issue for further investigation and fixing, but for now you would indeed add the RadInputManager as updated control.

    For second question: Unfortunately we cannot prevent the empty message disappear upon ajax.

    Regards,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top