IE11 When EmptyMessage is set OnSelectedIndexChanged event fires during every post back and properties SelectedIndex, SelectedItem have wrong values

3 posts, 0 answers
  1. Yiannis
    Yiannis avatar
    5 posts
    Member since:
    Jul 2012

    Posted 25 Feb 2014 Link to this post

    Set up info:
    Telerik version: 2013.2.611.40
    Browser: IE 11.0.9600.16476
    .NET Framework: 4.0

    Symptoms: During Asynch Post Backs when EmptyMessage property is set AND text of the first item is not English (eg. German, Greek) then OnSelectedIndexChange event fires every time although index has not been changed. Further more properties SelectedIndex, SelectedItem and SelectedValue have the wrong values of -1, null and "" respectively

    I have prepared a small project to demonstrate the bug but your forum allows only picture format attachments. So here is the test code:

    file: Default.aspx


    01.%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
    02. 
    03.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    05.<head runat="server">
    06.    <title></title>
    07.    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
    08.</head>
    09.<body>
    10.    <form id="form1" runat="server">
    11.    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    12.        <Scripts>
    13.            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
    14.            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
    15.            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    16.        </Scripts>
    17.    </telerik:RadScriptManager>
    18.    <script type="text/javascript">
    19.        //Put your JavaScript code here.
    20.    </script>
    21.    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    22.        <AjaxSettings>
    23.            <telerik:AjaxSetting AjaxControlID="TestIE">
    24.                <UpdatedControls>
    25.                    <telerik:AjaxUpdatedControl ControlID="TestIE" />
    26.                    <telerik:AjaxUpdatedControl ControlID="SaveValues" />
    27.                    <telerik:AjaxUpdatedControl ControlID="TestGrid" />
    28.                    <telerik:AjaxUpdatedControl ControlID="SaveButtonResults" />
    29.                </UpdatedControls>
    30.            </telerik:AjaxSetting>
    31.            <telerik:AjaxSetting AjaxControlID="SaveValues">
    32.                <UpdatedControls>
    33.                    <telerik:AjaxUpdatedControl ControlID="TestIE" />
    34.                    <telerik:AjaxUpdatedControl ControlID="SaveValues" />
    35.                    <telerik:AjaxUpdatedControl ControlID="TestGrid" />
    36.                    <telerik:AjaxUpdatedControl ControlID="SaveButtonResults" />
    37.                </UpdatedControls>
    38.            </telerik:AjaxSetting>
    39.            <telerik:AjaxSetting AjaxControlID="TestGrid">
    40.                <UpdatedControls>
    41.                    <telerik:AjaxUpdatedControl ControlID="TestIE" />
    42.                    <telerik:AjaxUpdatedControl ControlID="SaveValues" />
    43.                    <telerik:AjaxUpdatedControl ControlID="TestGrid" />
    44.                    <telerik:AjaxUpdatedControl ControlID="SaveButtonResults" />
    45.                </UpdatedControls>
    46.            </telerik:AjaxSetting>
    47.        </AjaxSettings>
    48.    </telerik:RadAjaxManager>
    49.    <div>
    50.        <telerik:RadComboBox runat="server" ID="TestIE" EmptyMessage="Pick one from the list"
    51.            OnSelectedIndexChanged="TestIE_OnSelectedIndexChanged" AutoPostBack="True">
    52.        </telerik:RadComboBox>
    53.        <asp:LinkButton runat="server" ID="SaveValues" OnClick="SaveValues_OnClick">Click to Save</asp:LinkButton>
    54.        <asp:Label runat="server" ID="SaveButtonResults" />
    55.        <telerik:RadGrid runat="server" ID="TestGrid" OnItemCreated="TestGrid_OnItemCreated" OnNeedDataSource="TestGrid_OnNeedDataSource" AllowAutomaticInserts="False" OnInsertCommand="TestGrid_OnInsertCommand" AutoGenerateColumns="False" AutoGenerateDeleteColumn="False" AutoGenerateEditColumn="False" ShowHeader="True" AllowFilteringByColumn="False">
    56.             <MasterTableView CssClass="LeftAlign" DataKeyNames="Id" GridLines="None" CommandItemDisplay="Top" EditMode="PopUp">
    57.                  <Columns>
    58.                      <telerik:GridTemplateColumn DefaultInsertValue="" UniqueName="MyBasicEntry.Description" HeaderText="Description" DataField="MyBasicEntry.Description"  ItemStyle-Wrap="False">
    59.                            <ItemTemplate>
    60.                                <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description")  %>'
    61.                                    ToolTip='<%# Eval("Description") %>' />
    62.                            </ItemTemplate>
    63.                            <EditItemTemplate>
    64.                                <telerik:RadComboBox runat="server" ID="TestIEInsideGrid"
    65.                                    EmptyMessage="Pick one from the list" OnSelectedIndexChanged="TestIEInsideGrid_OnSelectedIndexChanged" AutoPostBack="True"
    66.                                    CausesValidation="False" DropDownAutoWidth="Enabled" Width="200px" />
    67.                            </EditItemTemplate>
    68.                        </telerik:GridTemplateColumn>
    69.                  </Columns>
    70.                  <EditFormSettings ColumnNumber="2" InsertCaption="Εισαγωγή Αποσπάσεων" EditColumn-ButtonType="ImageButton"
    71.                        PopUpSettings-Modal="true" PopUpSettings-Width="950" PopUpSettings-Height="320">
    72.                        <FormTableItemStyle Wrap="False" />
    73.                        <FormMainTableStyle CellPadding="4" Width="100%" />
    74.                        <FormTableStyle CellPadding="4" CellSpacing="0" CssClass="LeftAlign" />
    75.                        <FormTableAlternatingItemStyle Wrap="False" />
    76.                        <FormTableButtonRowStyle HorizontalAlign="Right" />
    77.                    </EditFormSettings>
    78.             </MasterTableView>
    79.        </telerik:RadGrid>
    80.    </div>
    81.    </form>
    82.</body>
    83.</html>


    file: Default.aspx.designer.cs
    01.//------------------------------------------------------------------------------
    02.// <auto-generated>
    03.//     This code was generated by a tool.
    04.//
    05.//     Changes to this file may cause incorrect behavior and will be lost if
    06.//     the code is regenerated.
    07.// </auto-generated>
    08.//------------------------------------------------------------------------------
    09. 
    10. 
    11. 
    12.public partial class Default {
    13.     
    14.    /// <summary>
    15.    /// RadStyleSheetManager1 control.
    16.    /// </summary>
    17.    /// <remarks>
    18.    /// Auto-generated field.
    19.    /// To modify move field declaration from designer file to code-behind file.
    20.    /// </remarks>
    21.    protected global::Telerik.Web.UI.RadStyleSheetManager RadStyleSheetManager1;
    22.     
    23.    /// <summary>
    24.    /// form1 control.
    25.    /// </summary>
    26.    /// <remarks>
    27.    /// Auto-generated field.
    28.    /// To modify move field declaration from designer file to code-behind file.
    29.    /// </remarks>
    30.    protected global::System.Web.UI.HtmlControls.HtmlForm form1;
    31.     
    32.    /// <summary>
    33.    /// RadScriptManager1 control.
    34.    /// </summary>
    35.    /// <remarks>
    36.    /// Auto-generated field.
    37.    /// To modify move field declaration from designer file to code-behind file.
    38.    /// </remarks>
    39.    protected global::Telerik.Web.UI.RadScriptManager RadScriptManager1;
    40.     
    41.    /// <summary>
    42.    /// RadAjaxManager1 control.
    43.    /// </summary>
    44.    /// <remarks>
    45.    /// Auto-generated field.
    46.    /// To modify move field declaration from designer file to code-behind file.
    47.    /// </remarks>
    48.    protected global::Telerik.Web.UI.RadAjaxManager RadAjaxManager1;
    49.     
    50.    /// <summary>
    51.    /// TestIE control.
    52.    /// </summary>
    53.    /// <remarks>
    54.    /// Auto-generated field.
    55.    /// To modify move field declaration from designer file to code-behind file.
    56.    /// </remarks>
    57.    protected global::Telerik.Web.UI.RadComboBox TestIE;
    58.     
    59.    /// <summary>
    60.    /// SaveValues control.
    61.    /// </summary>
    62.    /// <remarks>
    63.    /// Auto-generated field.
    64.    /// To modify move field declaration from designer file to code-behind file.
    65.    /// </remarks>
    66.    protected global::System.Web.UI.WebControls.LinkButton SaveValues;
    67.     
    68.    /// <summary>
    69.    /// SaveButtonResults control.
    70.    /// </summary>
    71.    /// <remarks>
    72.    /// Auto-generated field.
    73.    /// To modify move field declaration from designer file to code-behind file.
    74.    /// </remarks>
    75.    protected global::System.Web.UI.WebControls.Label SaveButtonResults;
    76.     
    77.    /// <summary>
    78.    /// TestGrid control.
    79.    /// </summary>
    80.    /// <remarks>
    81.    /// Auto-generated field.
    82.    /// To modify move field declaration from designer file to code-behind file.
    83.    /// </remarks>
    84.    protected global::Telerik.Web.UI.RadGrid TestGrid;
    85.}


    file: Default.aspx.cs
    001.using System;
    002.using System.Collections.Generic;
    003.using System.Web;
    004.using System.Web.UI;
    005.using System.Web.UI.WebControls;
    006. 
    007.using System.Data;
    008.using System.Configuration;
    009.using System.Web.Security;
    010.using System.Web.UI.WebControls.WebParts;
    011.using System.Web.UI.HtmlControls;
    012.using Telerik.Web.UI;
    013.[Serializable]
    014.public class MyBasicEntry
    015.{
    016.    public int Id { get; set; }
    017.    public string Description { get; set; }
    018.    public MyBasicEntry(int Id, string Description)
    019.    {
    020.        this.Description = Description;
    021.        this.Id = Id;
    022.    }
    023.}
    024. 
    025.public partial class Default : System.Web.UI.Page
    026.{
    027.    private List<MyBasicEntry> GridSource { get { return (List<MyBasicEntry>)ViewState["GridSource"]; } set { ViewState["GridSource"] = value; } }
    028.    private List<MyBasicEntry> myBasicEntryList { get { return (List<MyBasicEntry>)ViewState["myBasicEntryList"]; } set { ViewState["myBasicEntryList"] = value; } }
    029.    protected void Page_Load(object sender, EventArgs e)
    030.    {
    031. 
    032.        if(!Page.IsPostBack)
    033.        {
    034.            GridSource = new List<MyBasicEntry>();
    035.            myBasicEntryList = new List<MyBasicEntry>();
    036.            myBasicEntryList.Add(new MyBasicEntry(1, "Heißen"));
    037.            //myBasicEntryList.Add(new MyBasicEntry(1, "ΚΑΝΑΔΑΣ"));
    038.            //myBasicEntryList.Add(new MyBasicEntry(1, "Germany"));
    039.            myBasicEntryList.Add(new MyBasicEntry(2, "München"));
    040.            myBasicEntryList.Add(new MyBasicEntry(3, "München1"));
    041.            myBasicEntryList.Add(new MyBasicEntry(3, "München 1"));
    042.            myBasicEntryList.Add(new MyBasicEntry(4, "Περισσότερα Ελληνικά"));
    043.            TestIE.DataSource = myBasicEntryList;
    044.            TestIE.DataValueField = "Id";
    045.            TestIE.DataTextField = "Description";
    046.            TestIE.DataBind();
    047.        }
    048.         
    049.    }
    050. 
    051.    protected void TestIE_OnSelectedIndexChanged(object Sender, RadComboBoxSelectedIndexChangedEventArgs E)
    052.    {
    053.        var selectedIndex = (Sender as RadComboBox).SelectedIndex;
    054.        var selectedItem = (Sender as RadComboBox).SelectedItem;
    055.        var selectedValue = (Sender as RadComboBox).SelectedValue;
    056.        var oldValue = E.OldValue;
    057.        var newValue = E.Value;
    058.        var oldText = E.OldText;
    059.        var newText = E.Text;
    060.    }
    061.    protected void TestIEInsideGrid_OnSelectedIndexChanged(object Sender, RadComboBoxSelectedIndexChangedEventArgs E)
    062.    {
    063.        var selectedIndex = (Sender as RadComboBox).SelectedIndex;
    064.        var selectedItem = (Sender as RadComboBox).SelectedItem;
    065.        var selectedValue = (Sender as RadComboBox).SelectedValue;
    066.        var oldValue = E.OldValue;
    067.        var newValue = E.Value;
    068.        var oldText = E.OldText;
    069.        var newText = E.Text;
    070.    }
    071.    protected void SaveValues_OnClick(object Sender, EventArgs E)
    072.    {
    073.        var selectedIndex = TestIE.SelectedIndex;
    074.        var selectedItem = TestIE.SelectedItem;
    075.        var selectedValue = TestIE.SelectedValue;
    076.        SaveButtonResults.Text = "You have selected: " + (TestIE.SelectedIndex == -1 ? "nothing" : selectedItem.Text + " at index " + int.Parse(selectedValue));
    077.    }
    078. 
    079.    protected void TestGrid_OnInsertCommand(object Sender, GridCommandEventArgs E)
    080.    {
    081.        var TestIEInsideGrid = (RadComboBox)E.Item.FindControl("TestIEInsideGrid");
    082.        var selectedIndex = TestIEInsideGrid.SelectedIndex;
    083.        var selectedItem = TestIEInsideGrid.SelectedItem;
    084.        var selectedValue = TestIEInsideGrid.SelectedValue;
    085.        GridSource.Add(new MyBasicEntry(int.Parse(selectedValue),selectedItem.Text));
    086.    }
    087. 
    088.    protected void TestGrid_OnItemCreated(object Sender, GridItemEventArgs E)
    089.    {
    090.        if ((E.Item is GridEditFormItem) && E.Item.IsInEditMode)
    091.        {
    092.            var TestIEInsideGrid = (RadComboBox)E.Item.FindControl("TestIEInsideGrid");
    093.            TestIEInsideGrid.DataSource = myBasicEntryList;
    094.            TestIEInsideGrid.DataValueField = "Id";
    095.            TestIEInsideGrid.DataTextField = "Description";
    096.            TestIEInsideGrid.DataBind();
    097.        }
    098.    }
    099. 
    100.    protected void TestGrid_OnNeedDataSource(object Sender, GridNeedDataSourceEventArgs E)
    101.    {
    102.        TestGrid.DataSource = GridSource;
    103.    }
    104.}

    file: Web.config
    01.<?xml version="1.0"?>
    02.<configuration>
    03.  <appSettings>
    04.    <add key="Telerik.Skin" value="Black"/>
    05.    <add key="Telerik.ScriptManager.TelerikCdn" value="Disabled"/>
    06.    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Disabled"/>
    07.  </appSettings>
    08.  <system.web>
    09.    <compilation debug="true" targetFramework="4.0"/>
    10.    <pages>
    11.      <controls>
    12.        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
    13.      </controls>
    14.    </pages>
    15.    <httpHandlers>
    16.      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
    17.      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
    18.      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
    19.      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
    20.      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
    21.    </httpHandlers>
    22.    <httpModules>
    23.      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule"/>
    24.      <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
    25.    </httpModules>
    26.  </system.web>
    27.  <system.webServer>
    28.    <validation validateIntegratedModeConfiguration="false"/>
    29.    <modules runAllManagedModulesForAllRequests="true">
    30.      <remove name="RadUploadModule"/>
    31.      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode"/>
    32.      <remove name="RadCompression"/>
    33.      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode"/>
    34.    </modules>
    35.    <handlers>
    36.      <remove name="ChartImage_axd"/>
    37.      <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode"/>
    38.      <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/>
    39.      <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode"/>
    40.      <remove name="Telerik_Web_UI_DialogHandler_aspx"/>
    41.      <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/>
    42.      <remove name="Telerik_RadUploadProgressHandler_ashx"/>
    43.      <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode"/>
    44.      <remove name="Telerik_Web_UI_WebResource_axd"/>
    45.      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/>
    46.    </handlers>
    47.  </system.webServer>
    48.</configuration>


    If you remove the EmptyMessage property or you set it to "" everything goes back to normal.
    Also if you comment out line line 36 and you uncomment out line 38 so that first Items text is English then every goes back to normal as well. So I think it should be an issue of the EmptyMessage property and the Encoding of the Items text in the JavaScript you are using.

    Thank you for your time and I remain to your disposal for any additional info you may need


  2. Yiannis
    Yiannis avatar
    5 posts
    Member since:
    Jul 2012

    Posted 26 Feb 2014 in reply to Yiannis Link to this post

    I just realised this is in the wrong section, it should be under ComboBox section. I'm sorry, Could someone from the Admin group remove this? I have already posted the same issue under ComboBox. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 28 Feb 2014 Link to this post

    Hello Yannis,

    I have replied to the other forum ticket that you had submitted, therefore I would like to ask you to continue the communication in the other thread, in order to avoid duplication.

    http://www.telerik.com/forums/ie11-when-emptymessage-is-set-onselectedindexchanged-event-fires-during-every-post-back-and-properties-selectedindex-selecteditem-have-wrong-values-0604dd63c0a3


    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top