Unplanned
Last Updated: 04 Mar 2020 12:47 by ADMIN
Bob
Created on: 04 Mar 2020 12:46
Category: MultiColumnComboBox
Type: Bug Report
1
SelectIndexChanged event not firing when DataTextField Content is the same

When items with different values have the same text, a postback is not triggered when selecting another item with the same text as the current selection. The workaround is to place the following script under the ScriptManager:

Telerik.Web.UI.RadMultiColumnComboBox.prototype._shouldPostbackOnChange = function myfunction() {
    return true;
}

Reproduction code:

<telerik:RadMultiColumnComboBox ID="RadMultiColumnComboBox1" DataKeyNames="Additional" runat="server" DropDownWidth="Auto" AutoPostBack="true" >
    <ClientEvents OnSelect="OnSelect" />
    <ColumnsCollection>
        <%--<telerik:MultiColumnComboBoxColumn Field="ID"></telerik:MultiColumnComboBoxColumn>--%>
        <telerik:MultiColumnComboBoxColumn Field="Name"></telerik:MultiColumnComboBoxColumn>
        <telerik:MultiColumnComboBoxColumn Field="Additional"></telerik:MultiColumnComboBoxColumn>
    </ColumnsCollection>
</telerik:RadMultiColumnComboBox>
<script>
    function OnSelect(sender, args) {
        //alert("selection changed");
    }
    // Workaround
    Telerik.Web.UI.RadMultiColumnComboBox.prototype._shouldPostbackOnChange = function myfunction() {
        return true;
    }
</script>

public class MyClass
{
    public int ID { get; set; }
    public string Name { get; set; }
    public string Additional { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadMultiColumnComboBox1.DataSource = Enumerable.Range(1, 20).Select(x => new MyClass()
        {
            ID = x,
            Name = "Same Item text" ,
            Additional = "DataKey#" + x
        });
        RadMultiColumnComboBox1.DataTextField = "Name";
        RadMultiColumnComboBox1.DataValueField = "ID";
        RadMultiColumnComboBox1.DataBind();
    }
}

 

 

0 comments