I am using RadCombox inside RadGrid, When I tried to select some value from the box it's throwing error, please can you suggest something
below is the code
Please suggest where I am wrong.
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
Parameter name: value]
Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +259
Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +10
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +83
Telerik.Web.UI.RadComboBox.PerformSelect() +21
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +515
Telerik.Web.UI.GridTableView.CreateFilteringItem(Boolean useDataSource, GridColumn[] copiedColumnSet, GridTHead thead) +100
Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +496
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +499
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
Telerik.Web.UI.GridTableView.PerformSelect() +4
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
Telerik.Web.UI.GridTableView.DataBind() +239
Telerik.Web.UI.GridTableView.Rebind() +48
Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) +515
Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +38
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +115
Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) +46
Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +5990
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618
below is the code
<
telerik:GridBoundColumn
UniqueName
=
"Name"
DataField
=
"Name"
HeaderText
=
"Name"
HeaderStyle-Width
=
"160px"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxTitle"
DataType
=
"System.Int32"
UniqueName
=
"Name"
Height
=
"200px"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Name").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function TitleIndexChanged(sender, args) {debugger;
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("Name", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
VariableGrd_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFilteringItem)
{
//RadComboBox combolist = (e.Item as GridEditableItem).FindControl("RadComboBoxTitle") as RadComboBox;
//combolist.DataSource = variableCollection["Name"];
//combolist.DataBind();
GridFilteringItem filterItem = (GridFilteringItem)e.Item;
RadComboBox combo = (RadComboBox)filterItem.FindControl(
"RadComboBoxTitle"
);
var test = variableCollection.Select(var =>
new
{ Name = var.VariableAliasName, Value = var.VariableAliasName }).Distinct().ToList();
combo.DataSource = test;
// combo.DataSource = perso;
combo.DataTextField =
"Name"
;
combo.DataValueField =
"Value"
;
combo.ClearSelection();
combo.DataBind();
}
Please suggest where I am wrong.