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

Trigger serverside when clearing text

18 Answers 186 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 18 Feb 2010, 02:50 PM
Hi.
I need to trigger serverside when the user clears the combobox input field.
Is this possible?

We have version 2008.2.723.35

Best regards

18 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 18 Feb 2010, 06:54 PM
Hi Anders,

You can use the TextChanged event handler to respond in server-side code when text in the input area changes, and optionally check if the text in RadComboBox input is an empty string.

More details about this event and a simple example you can find here.
Greetings,
Kalina
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
Anders
Top achievements
Rank 1
answered on 18 Feb 2010, 07:31 PM
Thanks for the reply.
This event does not trigger when clearing the textbox from text..

Regards, Anders
0
Anders
Top achievements
Rank 1
answered on 19 Feb 2010, 12:33 PM
Hi.
I found the problem, and its a bug with the box, i dont know if this is fixed in later version, we have licens for version 2008.2.723.35.
If you type something and blur the textbox without selecting anything in the dropdown it does a postback, if you clear the text and blur the textbox it does not postback.

However if you seleft something in the list it will work as suposed after this, if you type something it postbacks, if clear it postbacks, if you select a item in dropdown it postbacks etc.

Is this fixed in a later version?
0
Kalina
Telerik team
answered on 22 Feb 2010, 05:21 PM
Hi Anders,

Thank you for the clarification.

On order to recreate the issue I made a sample page with a RadComboBox and a Label.
The page logic is simple - when user changes the text in RadComboBox input - control performs PostBack and the text from the RadComboBox input is set as a Text property of the label.

<form id="form1" runat="server">
<div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadComboBox ID="combobox" runat="server"
        EnableLoadOnDemand="true"
        OnItemsRequested="Combobox_ItemsRequested"
        OnTextChanged="Combobox_TextChanged"
        AutoPostBack="true">
    </telerik:RadComboBox>
    <asp:Label ID="label" runat="server"></asp:Label>
</div>
</form>


public partial class RadComboBoxClearText : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void Combobox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        this.combobox.Items.Add(new RadComboBoxItem("product1", "1"));
        this.combobox.Items.Add(new RadComboBoxItem("product2", "2"));
    }
    protected void Combobox_TextChanged(object sender, EventArgs e)
    {
        if (combobox.Text != String.Empty)
        {
            label.Text = combobox.Text;
        }
        else
        {
            label.Text = "RadComboBox is empty";
        }
 
    }
}

As testing the RadComboBox behavior I followed the steps that you describe - at first I entered some text and blurred the RadComboBox, then I cleared the text and blurred the control again. In both cases RadComboBox performed PostBack.

In addition let me mention that I performed these steps with our current version (2010.1.216) and with your version (2008.2.723.35).

Can you please take a look at the sample code and test it on your side?
May be I am missing something - can you send me more details about this bug that you have found?


Greetings,
Kalina
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
Anders
Top achievements
Rank 1
answered on 22 Feb 2010, 07:41 PM
Thansks for the reply, and yes, It works.
And your little test lead me to the real bug in combobox.

The combobox resides in an updatepanel, when it postbacks it updates another updatepanel

I modified your sample to emulate our scenario.
The updatepanel that holds the combox has UpdateMode = Conditional and ChildrenAsTrigger = false
It is this that causes the combobox bug, please try it yourself.

Regards, Anders

<div> 
  <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="comboPanel" ChildrenAsTriggers="false" UpdateMode="Conditional" runat="server"
    <ContentTemplate> 
    <rad:RadComboBox ID="combobox" runat="server" 
        EnableLoadOnDemand="true" 
        OnItemsRequested="Combobox_ItemsRequested" 
        OnTextChanged="Combobox_TextChanged" 
        AutoPostBack="true"
    </rad:RadComboBox> 
 
    </ContentTemplate>   
    </asp:UpdatePanel> 
     
    <asp:UpdatePanel ID="targetPanel" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server"
      <ContentTemplate> 
        <asp:Label ID="label" runat="server"></asp:Label> 
      </ContentTemplate>         
    </asp:UpdatePanel>       
</div> 
      protected void Page_Load(object sender, EventArgs e) 
      { 
 
      } 
      protected void Combobox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
      { 
          this.combobox.Items.Add(new RadComboBoxItem("product1""1")); 
          this.combobox.Items.Add(new RadComboBoxItem("product2""2")); 
      } 
      protected void Combobox_TextChanged(object sender, EventArgs e) 
      { 
          if (combobox.Text != String.Empty) 
          { 
              label.Text = combobox.Text; 
          } 
          else 
          { 
              label.Text = "RadComboBox is empty"
          } 
          targetPanel.Update(); 
      }  

0
Anders
Top achievements
Rank 1
answered on 25 Feb 2010, 08:45 AM
Hello Kalina.
Have you looked into this bug? We really need to find a solution for this.

Regards, Anders


0
Kalina
Telerik team
answered on 26 Feb 2010, 08:50 AM
Hi Anders,

Thank you for the code snippet that you provided, and please excuse us for delayed reply.

I used this code "as is" to test the RadComboBox behavior with our current version (2010.1.216) and with your version (2008.2.723.35).  Tests were performed under IE8, Firefox 3.5.8 and Chrome 4.0.

With the older version control really behaves not quite properly, but with our latest version things look all right.
Can you please take a look at this demonstration video?
I can suggest you to download a trial of our latest version from your Telerik account.

All the best,
Kalina
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
Mårten Lind
Top achievements
Rank 1
answered on 04 Mar 2010, 03:54 PM
Hi.
We have now bought a new license and upgraded to version 2010.1.216.35
The bug still remains

Regards, Anders
0
Kalina
Telerik team
answered on 04 Mar 2010, 04:36 PM
Hi MÃ¥rten Lind,

Does the code on your side differ from the code snippet that you sent to us?

I used this code "as is" to test the RadComboBox behavior and it worked properly.

In order to help you I need a sample running page that reproduces the issue and/or a demonstration video.

Thank you in advance.

All the best,
Kalina
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
Anders
Top achievements
Rank 1
answered on 05 Mar 2010, 09:06 AM
Hi.
No, i've tested with that code, didnt work.

I recorded a clip from the actual system this will be used in, please check it out

agero.se/temp/telerik.avi

/Anders



0
Anders
Top achievements
Rank 1
answered on 08 Mar 2010, 12:56 PM
Please let me know if you need more info.

/Anders
0
Kalina
Telerik team
answered on 09 Mar 2010, 09:56 AM
Hi Anders,

Thank you for the demonstration video.

Since I still do not have any code from you I made tests with the example that I sent to you and I think that I succeeded to reproduce the issue.

A scenario where you might set ChildrenAsTriggers to false is when you have two UpdatePanel controls and you want a postback from the first panel to update the content of the second panel but not update its own content. 

But in our case it appears that setting ChildrenAsTriggers to false disturbs the RadComboBox postbacks.
That is why I will recommend you to remove ChildrenAsTriggers property of the UpdatePanel.

<form id="form1" runat="server">
<div><%-- ChildrenAsTriggers="false"--%>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel ID="comboPanel" UpdateMode="Conditional"
    
        runat="server">
        <ContentTemplate>
          <telerik:radcombobox id="combobox" runat="server"
          enableloadondemand="true"
          onitemsrequested="Combobox_ItemsRequested" 
                ontextchanged="Combobox_TextChanged" autopostback="true" >
             </telerik:radcombobox>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="targetPanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Label ID="label" runat="server"></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
</form>


If the issue persists I will need the exact running code that you use to reproduce the issue in the video.

All the best,
Kalina
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
Anders
Top achievements
Rank 1
answered on 09 Mar 2010, 10:35 AM
Hi.
Whe have it set to false because the content of the updatepanel where the combobox resides does not need update.
We only update the upgrade grid where the search result is. We do this to minimize the size of the httprequest because of speed.

All other controls work perfect with this setup, and this is how the updatepanel is meant to work. I've tried a quick test with a custom webcontrol that did postbacks and it worked both with childerastrigger on and off. Are you injecting a script to late or something?

There is some kind of bug in your API. If you check with Fiddler or with Firebug you can see that the postback is never triggered.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> 
 
<html> 
 
<body> 
<form id="form1" runat="server"
<div> 
  <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="comboPanel" ChildrenAsTriggers="false" UpdateMode="Conditional" runat="server"
    <ContentTemplate> 
    <rad:RadComboBox ID="combobox" runat="server" 
        EnableLoadOnDemand="true" 
        OnItemsRequested="Combobox_ItemsRequested" 
        OnTextChanged="Combobox_TextChanged" 
        AutoPostBack="true"
    </rad:RadComboBox> 
 
    </ContentTemplate>   
    </asp:UpdatePanel> 
     
    <asp:UpdatePanel ID="targetPanel" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server"
      <ContentTemplate> 
        <asp:Label ID="label" runat="server"></asp:Label> 
      </ContentTemplate>         
    </asp:UpdatePanel>       
</div> 
</form> 
  </body> 
</html> 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
 
namespace WebApplication1 
  public partial class _Default : System.Web.UI.Page 
  { 
      protected void Page_Load(object sender, EventArgs e) 
      { 
 
      } 
      protected void Combobox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
      { 
          this.combobox.Items.Add(new RadComboBoxItem("product1""1")); 
          this.combobox.Items.Add(new RadComboBoxItem("product2""2")); 
      } 
      protected void Combobox_TextChanged(object sender, EventArgs e) 
      { 
          if (combobox.Text != String.Empty) 
          { 
              label.Text = combobox.Text; 
          } 
          else 
          { 
              label.Text = "RadComboBox is empty"
          } 
          targetPanel.Update(); 
      }  
 
  } 

Regards, Anders



0
Kalina
Telerik team
answered on 10 Mar 2010, 01:01 PM
Hi Anders,

The issue is a bug which we have logged in our Issue Tracking System. Until we fix the bug, you can use a workaround - handle the OnClientTextChanged event in this way:
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript">
        function combobox_OnClientTextChange(sender, args) {
            sender._originalText = sender.get_text();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="comboPanel" UpdateMode="Conditional"
            ChildrenAsTriggers="false"  runat="server">
            <ContentTemplate>
                <telerik:RadComboBox ID="combobox" runat="server"
                    EnableLoadOnDemand="true"
                    OnClientTextChange="combobox_OnClientTextChange"
                    OnItemsRequested="Combobox_ItemsRequested"
                    OnTextChanged="Combobox_TextChanged"
                    AutoPostBack="true">
                </telerik:RadComboBox>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdatePanel ID="targetPanel" runat="server"
            UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Label ID="label" runat="server"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>

Greetings,
Kalina
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
Anders
Top achievements
Rank 1
answered on 05 May 2010, 03:20 PM
The bug still remains, even after upgrading to 2010.1.415.35
We really need this fixed, can you please release this fix soon?

Best regards, Anders
0
Kalina
Telerik team
answered on 10 May 2010, 02:05 PM
Hi Anders,

I created a sample project for you with our latest trial hotfix version ( 2010.1.415 ) and tested the bugfix.
On my side after deleting the text from RadComboBox input OnTextChanded event fires properly.

Could you please find the sample project attached and test it?
What is different on your side?

Best wishes,
Kalina
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
Anders
Top achievements
Rank 1
answered on 10 May 2010, 03:00 PM
Hi.
If you look at the message log you see what you have done wrong with your new example, you have removed the attribute
ChildrenAsTriggers
="false"
(On the updatepanel) from your example, add that one and the bug is there again.

This is reported as a bug and you promised us to have this fixed in later release, we need this very soon since our product is soon ready for release. I say again, the problem is if you have ChildenAsTriggers=false that this bug is shown. Check the message log if you do not understand the bug.

Best regards, Anders

0
Kalina
Telerik team
answered on 12 May 2010, 09:30 AM
Hi Anders,

Thank you for the clarification.

We raised the priority of this bug so that we start working on it sooner.
I will follow up in this support thread to let you know when the fix is ready.

Please excuse us for the inconvenience caused.

Regards,
Kalina
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
ComboBox
Asked by
Anders
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Anders
Top achievements
Rank 1
Mårten Lind
Top achievements
Rank 1
Share this question
or