More in this section

Forums / Developing with Sitefinity / RadConmbobox and FireFox

RadConmbobox and FireFox

1 posts, 0 answered
  1. Luc Baeten
    Luc Baeten avatar
    169 posts
    23 Sep 2005
    06 Jun 2011
    Link to this post
    Hello Sitefinity Team

    (use of Sitefinity 3.7.2136)

    I created the following test page that should show the following functionality: when I select the second item in the comboxbox with the keyboard and press the enter button or select the second item with the mouse an alert with the text defined in the "Info1" attribute should be shown.

    In IE this works fine but in FireFox a postback is carried out before the alert/confirm is shown when pressing the enter key. How can I prevent Firefox from handling the postback event before the alert/confirm is shown?

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadComboboxItem.aspx.cs"
        Inherits="RadComboboxItem" %>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var eventFired = false;
            function KeyPressCombo(sender, e) {
                if (e.get_domEvent().keyCode == 13) {
                    eventFired = false;
            function IndexChangedCombo(sender, e) {
                if (!eventFired) {
                    //sender.get_selectedItem() is the current item; eventArgs.get_item() the new selected item
                    var item = e.get_item(); //index changed
                    if (!item) item = sender.findItemByText(sender.get_text()); //enter button pressed
                    if (item) {
                        var itemText = item.get_text();
                        var itemInfo = item.get_attributes().getAttribute("Info1");
                        if (itemInfo) {
                            if (confirm(itemInfo)) {
                                eventFired = true;
                            else {
                                eventFired = true;
                        else {
                            //Enter key press
                            if (itemText != "") {
                                eventFired = true;
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="scriptmanager">
            <asp:Label ID="lblPosback" runat="server"></asp:Label><br />
            <telerik:RadComboBox ID="cbo_input" runat="server" AutoPostBack="false"
                 Width="250" OnClientKeyPressing="KeyPressCombo" OnClientSelectedIndexChanged="IndexChangedCombo" >

    Code Behind
    using System;
    using Telerik.Web.UI;
    public partial class RadComboboxItem : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
                RadComboBoxItem cboItem1 = new RadComboBoxItem();
                RadComboBoxItem cboItem2 = new RadComboBoxItem();
                string info1 = "Attention: an error has occured";
                cboItem1.Text = "This is a test 1";
                cboItem1.Value = "1";
                cboItem2.Text = "This is a test 2";
                cboItem2.Value = "2";
                cboItem2.Attributes.Add("Info1", info1);
                lblPosback.Text = "No Postback";
                lblPosback.Text = "Postback";


1 posts, 0 answered