I hv give the exception run time
Server Error in '/GowanKB' Application.
Selection out of range
Parameter name: value
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Selection out of range
Parameter name: value
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
[ArgumentOutOfRangeException: Selection out of range |
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
why this come
my querty is
SELECT DisplayName + ' ' + CoopOrg AS Name, Email FROM dbo.Coop
i can create the dummy column Name by using 2 different column it working sucessfully
and combobox property are
<telerik:RadComboBox ID="radcoopname" runat="server" Width="310" AppendDataBoundItems="true"
MarkFirstMatch="true" AutoPostBack="true" DataSourceID="coopname" DataTextField="Name"
DataValueField="Email" ExpandAnimation-Type="InQuart" CollapseAnimation-Duration="200"
CollapseAnimation-Type="Linear" CollapseDelay="400" CausesValidation="True">
<Items>
<telerik:RadComboBoxItem Text="Select Coop Name" />
</Items>
</telerik:RadComboBox>
and code behind
radcoopname.SelectedValue = (Session("CoOpDetail")).ToString
i need to select the session value when the combox load
how i do this help me urgentttt
Can you please tell me where is the problem why this exception occure
9 Answers, 1 is accepted
Best wishes,
Simon
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.


This worked before:
rcbCustomerCategory.DataSource = GetViewableCustomerCategories();
rcbCustomerCategory.DataTextField = "Name";
rcbCustomerCategory.DataValueField = "Id";
rcbCustomerCategory.DataBind();
rcbCustomerCategory.Items.Insert(0, new RadComboBoxItem("", "0"));
Now it needs to be:
rcbCustomerCategory.ClearSelection();
rcbCustomerCategory.DataSource = GetViewableCustomerCategories();
rcbCustomerCategory.DataTextField = "Name";
rcbCustomerCategory.DataValueField = "Id";
rcbCustomerCategory.DataBind();
rcbCustomerCategory.Items.Insert(0, new RadComboBoxItem("", "0"));
So, this is probbaly a breaking chanage in 2010 Q3 and 2011 Q1.
The code was rebinding the same control. But worked with 2010 Q2 broke after an upgrade.
We have not made any changes in regards to this functionality. What is more the exception has been in RadComboBox since its creation, so not having the exception is curious.
Is this all the code related to the RadComboBox? How did you submit the page when the exception occurred? Can you provide me with a minimum markup and code that are enough to reproduce the problem on a clean page?
All the best,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

This is the demo page. The important things to notice are:
1) ViewState is disabled on the page
2) When you hit submit the page either crashes or is ok depending on things mentioned below:
a) The code works fine if 2010 Q2 .NET 4.0 controls are referenced
b)The code crashes if 2011 Q1 .NET 4.0 controls are referenced (I upgraded in order to fix IE9 issues)
c) adding the commented line "//rcbCustomerCategory.ClearSelection(); " fixes the problem for 2011 Q1 controls.
I was aware of this issue with older controls. There were cases that I had to add "ClearSelection" but in most stituation I had no issue. This example code worked (for a long time) before it started experiencing problems (after an upgrade to 2011 Q1).
Also, this is just one example. I got this error in few places (probably all similar, not exact - some combos were populated via a web service for example).
This is the markup:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DefaultPage.aspx.cs" Inherits="RadComboClearItems.DefaultPage" EnableViewState="false" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
div
>
<
telerik:RadComboBox
ID
=
"rcbCustomerCategory"
Runat
=
"server"
EmptyMessage
=
"Select Customer Type"
MarkFirstMatch
=
"true"
AllowCustomText
=
"false"
EnableTextSelection
=
"false"
Width
=
"220"
Height
=
"140"
/> <
asp:Button
runat
=
"server"
ID
=
"btnSubmitt"
Text
=
"Submit"
/>
</
div
>
</
form
>
</
body
>
</
html
>
This is the code:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
namespace
RadComboClearItems
{
public
partial
class
DefaultPage : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
//rcbCustomerCategory.ClearSelection();
rcbCustomerCategory.DataSource = GetViewableCustomerCategories();
rcbCustomerCategory.DataTextField =
"Name"
;
rcbCustomerCategory.DataValueField =
"Id"
;
rcbCustomerCategory.DataBind();
rcbCustomerCategory.Items.Insert(0,
new
RadComboBoxItem(
""
,
"0"
));
}
private
static
List<Category> GetViewableCustomerCategories()
{
return
new
List<Category> {
new
Category { Id = 1, Name =
"Categ 1"
},
new
Category { Id = 2, Name =
"Categ 2"
} };
}
}
public
class
Category
{
public
string
Name {
get
;
set
; }
public
int
Id {
get
;
set
; }
}
}
This is the error message:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Selection out of range
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Selection out of range
Parameter name: value
Source Error:
Line 17: rcbCustomerCategory.DataTextField = "Name";
Line 18: rcbCustomerCategory.DataValueField = "Id";
Line 19: rcbCustomerCategory.DataBind();
Line 20: rcbCustomerCategory.Items.Insert(0, new RadComboBoxItem("", "0"));
Line 21: }
Source File: C:\Projects\KJRB\Experiments\RadComboClearItems\DefaultPage.aspx.cs Line: 19
Stack Trace:
[ArgumentOutOfRangeException: Selection out of range
Parameter name: value]
Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +299
Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +299
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +661
Telerik.Web.UI.RadComboBox.PerformSelect() +21
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
Telerik.Web.UI.RadComboBox.DataBind() +38
RadComboClearItems.DefaultPage.Page_Load(Object sender, EventArgs e) in C:\Projects\KJRB\Experiments\RadComboClearItems\DefaultPage.aspx.cs:19
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Thank you for the code and the instructions.
Indeed the exception is not present in the Q2 2010 release, however, it should have been there. Probably some other bug, which we have resolved after that, is preventing the exception for some reason.
So, the exception is thrown when the new data source does not contain the previously selected value. In your case, the first Item is selected (with value '0') on the first page load. If the page is posted back without any changes to the selection of the RadComboBox, after calling DataBind, the first Item (with value '0') will not exist in the data source, hence the exception will be thrown.
Another way of avoiding the error, in addition to calling ClearSelection is the following:
protected
void
Page_Load(
object
sender, EventArgs e)
{
//rcbCustomerCategory.ClearSelection();
rcbCustomerCategory.DataSource = GetViewableCustomerCategories(Page.IsPostBack);
rcbCustomerCategory.DataTextField =
"Name"
;
rcbCustomerCategory.DataValueField =
"Id"
;
rcbCustomerCategory.Items.Insert(0,
new
RadComboBoxItem(
""
,
"0"
));
rcbCustomerCategory.AppendDataBoundItems =
true
;
rcbCustomerCategory.DataBind();
}
I hope this helps.
Greetings,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Appreciate it.

We also have this issue with 2011 Q1.
We've been using the controls Sept of 2009.
This breaks cascading comboboxes.
The example would be a make and model for cars.
Not sure i understand why the correct behaviour after a databind is an error
if the old selection is missing from the new data.
If the fix is to put a ClearSelection before the databind what condition would
exist if i don't have to put ClearSelection.
In our case we have to review 287 databinds in 47 files. Not really looking forward
to that.
Should i open a ticket?
Thanks
Let me first briefly introduce you to the origins of the exception. The reason for its existence is that it also is thrown by the standard ASP.NET DropDownList control in exactly the same setup. When RadComboBox for ASP.NET AJAX was built the main design goal of the developers was to make it a 100% substitute for the DropDownList, so they mimicked not only the latter's benefits but also its peculiarities. This exception is one such peculiarity.
Now, you are perfectly right: "In our case we have to review 287 databinds in 47 files. Not really looking forward to that." Additionally there seems to be no valid reason for this exception to be thrown when, for instance, the selection could simply reset in the given case.
Since this issue is generating a lot of frustration we will consider getting rid of the exception or provide a more meaningful exception message.
All the best,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.