Unplanned
Last Updated: 29 Sep 2016 07:46 by ADMIN
ADMIN
Ivan Danchev
Created on: 29 Sep 2016 07:45
Category: Navigation
Type: Bug Report
0
A "Selection out of range" exception is thrown on item selection in ComboBox (LOD) nested in Navigation NodeTemplate

1. Click the ComboBox

2. Select an item in its dropdown

3. Expected: no exception on selection, actual: A "Selection out of range" exception is thrown.

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class ComboBoxNavigation : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
        }
    }

    private DataTable CreateTestTable()
    {
        DataTable table = new DataTable();
        table.Columns.Add("Text");
        table.Columns.Add("Value");
        table.Columns.Add("test");
        table.Rows.Add("Item1", "1", "aaa");
        table.Rows.Add("Item1", "1", "aaa");
        table.Rows.Add("Item1", "1", "aaa");
      
        return table;
    }

    protected void rcbStaff_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {

        RadComboBox rcbUser = sender as RadComboBox;
        rcbUser.DataSource = CreateTestTable();
        rcbUser.DataTextField = "Text";
        rcbUser.DataValueField = "Value";
        rcbUser.DataBind();

    }

    protected void rcbStaff_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {

    }
}

            <telerik:RadNavigation ID="RadNavigation1" runat="server">
                <Nodes>
                    <telerik:NavigationNode Text="Home"  />
                    <telerik:NavigationNode Text="Candidate"  />
                    <telerik:NavigationNode Text="Preliminary Candidate"  />
                    <telerik:NavigationNode Text="StaffSearch" CssClass="staffSearchWrapper rootTemplate">
                        <NodeTemplate>
                            <telerik:RadComboBox ID="rcbStaff" 
                                AutoPostBack="true" 
                                runat="server"
                                EnableLoadOnDemand="True" 
                                OnItemsRequested="rcbStaff_ItemsRequested"
                                OnSelectedIndexChanged="rcbStaff_SelectedIndexChanged"
                               >
                            </telerik:RadComboBox>
                        </NodeTemplate>
                    </telerik:NavigationNode>
                </Nodes>
            </telerik:RadNavigation>


		
0 comments