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

RadComboBox postbacks only when losing focus?

1 Answer 279 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 05 Sep 2012, 06:57 AM
Hey All,

I've been searching for a solution to this problem for days now and its starting to get ridiculous. The page I'm building is quite simple. It's got 4 RadComboBoxes, each bound to an ASP SqlDataSource with their SelectCommand set to nothing (SelectCommand=""), except the first one. Once the page loads, the user needs to choose an option from the very first combo box which contains list items only. Once the item is selected, the control posts back and I can then generate the SQL query required to populate the second combo box. Once the user has made his/her selection in the second combo box, the SQL query is build up again for the third combo box and so forth. As mentioned, the first combo box contains list items only and then the 2nd, 3rd and 4th combo boxes contains checkboxes (user must select multiple items from each). Once the combo box (containing the checkboxes) are closed, there is no postback occurring - only when that control has lost focus, then the post back occurs. To the end-user, it seems like the system isn't responding but in the meantime, the Telerik RadComboBox isn't posting back as it should.

At first I thought it might be a setting I've added there that's causing this, but after creating a test page and only the basic settings, the same problem occurs:

ASPX:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestCombo.aspx.cs" Inherits="TestCombo" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
     
    <telerik:RadScriptManager ID="ScriptManager1" runat="server"></telerik:RadScriptManager>
     
    <div>
        <telerik:RadComboBox ID="cboTest" runat="server" AutoPostBack="true"
            CheckBoxes="true" AllowCustomText="false"
            onselectedindexchanged="cboTest_SelectedIndexChanged">
            <Items>
                <telerik:RadComboBoxItem Text="Item 1" Value="1" />
                <telerik:RadComboBoxItem Text="Item 2" Value="2" />
            </Items>
        </telerik:RadComboBox>
    </div>
    </form>
</body>
</html>

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class TestCombo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void cboTest_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        throw new Exception("SelectedIndexChanged");
    }
}

It is quite vital for me to have the combobox post back as soon as its closed (not when it has lost focus). Is there any workaround for this?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Sep 2012, 09:20 AM
Hi Juan,

You can trigger postback in OnClientDropDownClosed Event of RadCombobox as follows.

Javascript:
<script type="text/javascript">
  function OnClientDropDownClosed(sender, args)
  {
   __doPostBack("<%= RadComboBox1.ClientID %>", "");
  }
</script>

Thanks,
Princy.
Tags
ComboBox
Asked by
Juan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or