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

RadComboBox of OnItemsRequested text="" will pop up error :The array can't be empty. Parameter name: bytes

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ghd258 ghd258
Top achievements
Rank 1
ghd258 ghd258 asked on 21 Jan 2018, 09:55 AM

RadComboBox of OnItemsRequested text="" 

When the mouse moves to the selection box, the error will pop up due to the empty value. will pop up error :The array can't be empty. Parameter name: bytes

The 2016.2.607.40 version is OK, and the later version has this error

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProFlowDirectionEdit.aspx.cs" Inherits="Healthway.XA.Web.UI.Pages.FlowDirection.ProFlowDirectionEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
        <div>
            <telerik:RadComboBox  ID="RadComboBoxProduct" runat="server" Height="200" Width="315" 
DropDownWidth="315"  Text="" HighlightTemplatedItems="true"
EnableLoadOnDemand="true" Filter="StartsWith" OnItemsRequested="rcbCustomer_ItemsRequested"
Skin="Office2010Silver">
<HeaderTemplate>
<table style="width: 275px" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 175px;">
Product Name
</td>
<td style="width: 60px;">
Quantity
</td>
<td style="width: 40px;">
Price
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table style="width: 275px" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 175px;">
<%# DataBinder.Eval(Container, "Text")%>
</td>
<td style="width: 60px;">
<%# DataBinder.Eval(Container, "Attributes['CusCode']")%>
</td>
<td style="width: 40px;">
<%# DataBinder.Eval(Container, "Attributes['CusName']")%>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadComboBox>
        </div>

    </form>
</body>
</html>

 protected void rcbCustomer_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {

            string sqlSelectCommand = "SELECT [CusCode], [CusName] from [Customer] WHERE [CusName] LIKE @text + '%' ORDER BY [CusName]";

            SqlDataAdapter adapter = new SqlDataAdapter(sqlSelectCommand,
                ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
            adapter.SelectCommand.Parameters.AddWithValue("@text", e.Text);
            DataTable dataTable = new DataTable();
            adapter.Fill(dataTable);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                RadComboBoxItem item = new RadComboBoxItem();

                item.Text = (string)dataRow["CusName"];
                item.Value = dataRow["CusCode"].ToString();



                //RadComboBoxProduct.Items.Add(item);

                item.DataBind();
            }
        }

2 Answers, 1 is accepted

Sort by
0
ghd258 ghd258
Top achievements
Rank 1
answered on 21 Jan 2018, 10:25 AM
UI for ASP.NET AJAX R3 2016 (version 2016.3.914)  version is OK ;and the later version has this error
0
ghd258 ghd258
Top achievements
Rank 1
answered on 21 Jan 2018, 12:59 PM
Finally find out the reason, because the web.config configuration <httpRuntime maxRequestLength= "102400" encoderType= "Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" if there is the configuration of the encoderType= "Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" the emergence of this error, configuration for the <httpRuntime maxRequestLength= "102400" / > can, if coupled with encoderType= "Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" is wrong. Demo also made a mistake if it was configured.
Tags
General Discussions
Asked by
ghd258 ghd258
Top achievements
Rank 1
Answers by
ghd258 ghd258
Top achievements
Rank 1
Share this question
or