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

StayOpenComboBox without using templates

1 Answer 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Peichung
Top achievements
Rank 1
Peichung asked on 31 Oct 2008, 01:04 PM

Hi,

I would like to implement StayOpenComboBox without using templates.  I followed the sample project, but it doesn't work.  Here is what I have:

var allowClose = false;  
 
function OnClientDropDownClosing(combobox)  
{  
     if(allowClose == true)  
     {  
        allowClose = false;  
        return true;  
     }  
     else 
     {  
        return false;   
     }  
}  
 
function allowCBClose(allow)  
{  
    allowClose = allow;  


<telerik:RadComboBox ID="RadComboBox1" Height="200px"
    ShowToggleImage="true" AllowCustomText="true"
    RadComboBoxImagePosition="Right" AutoPostBack="true"
    OnSelectedIndexChanged="OnComboSelectedChange"
    OnClientDropDownClosing="OnClientDropDownClosing"
    Runat="server" > 
    <CollapseAnimation Type="OutQuint" Duration="200">
    </CollapseAnimation> 
</telerik:RadComboBox> 


protected void Page_Load(object sender, EventArgs e)  
{  
    if (!IsPostBack)  
    {  
        RadComboBoxItem a
            = 
new RadComboBoxItem("RadComboBoxItem4", "4");  
        a.Attributes["onclick"] = "allowCBClose(false);";  
        RadComboBox1.Items.Add(a);  
 
        a = new RadComboBoxItem("RadComboBoxItem5", "5");  
        a.Attributes["onclick"] = "allowCBClose(false);";  
        RadComboBox1.Items.Add(a);  
    }  
 


As far as I can tell, allowCBClose() was called when items were clicked.  However, the combobox still close after clicking.  Thanks,

Peichung

1 Answer, 1 is accepted

Sort by
0
Peichung
Top achievements
Rank 1
answered on 31 Oct 2008, 09:35 PM

Problem solved.  Thanks.

Tags
ComboBox
Asked by
Peichung
Top achievements
Rank 1
Answers by
Peichung
Top achievements
Rank 1
Share this question
or