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

[Solved] Do postBack when the RadComboBox's selection has changed

1 Answer 137 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ashley Green
Top achievements
Rank 1
Ashley Green asked on 29 Jul 2009, 10:29 PM
Hello,

I'm trying to achieve the following: if the selection of the drop down has not changed, do not postBack. if the selection has changed, do postBack. How would I achieve this? I tried to change OnClientDropDownClosing to OnClientSelectedIndexChanged but the OnClientSelectedIndexChanged event was not fired.

I'm using version 2009.2.701.35. My sample code is as below. Thanks for your help!

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Untitled Page</title> 
    <style type="text/css">  
        .Hidden  
        {  
            visibility: hidden;  
        }  
    </style> 
</head> 
<body> 
 
    <script type="text/javascript">  
    function checkboxClick(e)    
       {    
            e.cancelBubble = true;    
            if (e.stopPropagation)    
            {    
                e.stopPropagation();    
            }    
        }    
 
        function OnClientDropDownClosing(sender)  
        {  
           document.getElementById(sender.get_id() + "Helper").click();  
        }  
    </script> 
 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <div> 
        <telerik:RadComboBox runat="server" ID="RadComboBox1" Height="200" HighlightTemplatedItems="true" 
            AutoPostBack="false" AllowCustomText="true" Text="All">  
            <Items> 
                <telerik:RadComboBoxItem Text="One" /> 
                <telerik:RadComboBoxItem Text="Two" /> 
                <telerik:RadComboBoxItem Text="Three" /> 
            </Items> 
            <ItemTemplate> 
                <div> 
                    <asp:CheckBox onclick="checkboxClick(event);" runat="server" ID="CheckBox" Text="" /> 
                    <%# DataBinder.Eval(Container, "Text") %> 
                </div> 
            </ItemTemplate> 
        </telerik:RadComboBox> 
        <asp:Button ID="RadComboBox1Helper" runat="server" Text="" CssClass="Hidden" OnClick="ButtonHelper_Click" /> 
    </div> 
    </form> 
</body> 
</html> 
 

using System;  
using System.Web.UI;  
 
public partial class _Default : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!IsPostBack)  
        {  
            RadComboBox1.DataBind();  
            RadComboBox1.OnClientDropDownClosing = "OnClientDropDownClosing";  
            //RadComboBox1.OnClientSelectedIndexChanging = "OnClientDropDownClosing";  
        }  
        Page.Title = "new title";  
    }
    #region DropDown Closed Events  
    protected void ButtonHelper_Click(object sender, EventArgs e)  
    {  
        RadComboBox1.Text = "13";  
    }
    #endregion  

Thanks,
Ashley

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 30 Jul 2009, 10:44 AM
Hello Ashley Green,

I have already replied to your post in this forum thread.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Ashley Green
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or