RadComboBox Error Selection out of range Parameter name: value

7 posts, 0 answers
  1. Ambuj
    Ambuj  avatar
    31 posts
    Member since:
    Dec 2008

    Posted 22 Mar 2011 Link to this post

    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
    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.

  2. Ambuj
    Ambuj  avatar
    31 posts
    Member since:
    Dec 2008

    Posted 23 Mar 2011 Link to this post

    Any help would be appreciated.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 23 Mar 2011 Link to this post

    Hi Ambuj,

    Please set the SelectedValue of RadComboBox not declaratively, but after binding it the code behind:

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            ..........................
            combo.DataBind();
            combo.SelectedValue = e.Item.OwnerTableView.GetColumn("Name").CurrentFilterValue;
        }
    }


    Regards,
    Helen
    the Telerik team
  5. ks
    ks avatar
    2 posts
    Member since:
    Aug 2011

    Posted 17 Sep 2011 Link to this post



    <
    FormTemplate>
             <table id="Table1"  border="0"  width="100%">
                              
                            <tr>
                                <td>
                                    date:
                                </td>
                                <td >
                                     
                                  <telerik:RadDatePicker ID="RadDatePicker1" runat="server"  DbSelectedDate='<%# Bind("date") %>' 
                                  AutoPostBack="True" DataFormatString="{0:MM/dd/yyyy}"
    >
                                </telerik:RadDatePicker >
                                      
                                </td>
                                  
                                  
                            </tr>
                            <tr>
                                <td>
                                    Code Client:
                                </td>
                                <td>
                                <telerik:RadComboBox runat="server" ID="RadComboBox4" DataTextField="code_client"
                        EnableLoadOnDemand="True" DataSourceID="LinqDataSource1" OnItemsRequested="RadComboBox1_ItemsRequested"
                        Width="240" Height="190px" HighlightTemplatedItems="true" 
                DataValueField="code_client"  AllowCustomText="True" AutoPostBack="True">
                        <HeaderTemplate>
                            <ul>
                                <li class="col1">Code Client</li>
                                <li class="col2">Nom</li>
                                  
                            </ul>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <ul>
                                <li class="col1">
                                    <%# Eval("code_client") %></li>
                                <li class="col2">
                                    <%# Eval("nom") %></li>
                                 
                            </ul>
                        </ItemTemplate>
                    </telerik:RadComboBox>
      
          
          
                                     
                                </td>
                            </tr>
                              
                            <tr>
                                  
                                <td>
                                    Code Projet:
                                </td>
                                <td>
      
                                   <telerik:RadComboBox ID="RadComboBox1" Runat="server" SelectedValue='<%# Bind( "code_projet") %>'
              Text='<%# Bind( "code_projet") %>'  OnClientSelectedIndexChanging="LoadTheme"
                    OnItemsRequested="RadComboBox1_ItemsRequested">
        </telerik:RadComboBox>
      
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Code Theme:
                                </td>
                                <td>
                                <telerik:RadComboBox ID="RadComboBox2" Runat="server" SelectedValue='<%# Bind( "code_theme") %>'
            OnClientSelectedIndexChanging="LoadTheme" 
                    OnClientItemsRequested="ItemsLoaded"
                    OnItemsRequested="RadComboBox2_ItemsRequested" Text='<%# Bind( "code_theme") %>' >
        </telerik:RadComboBox>
                                      
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Montant HT:
                                </td>
                                <td>
      
                                   <telerik:RadComboBox ID="RadComboBox3" Runat="server" SelectedValue='<%# Bind( "montant_ht_theme") %>'
            OnClientItemsRequested="ItemsLoaded"
                    OnItemsRequested="RadComboBox3_ItemsRequested" Text='<%# Bind( "montant_ht_theme") %>' >
        </telerik:RadComboBox>
                                      
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    nombre jour du formation:
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind( "nbr_jour_formation" ) %>'>
                                    </asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Nombre du Groupe:
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind( "nbr_groupe") %>'>
                                    </asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Nombre du Personne par Groupe:
                                </td>
                                <td>
      
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind( "nbr_personne_groupe") %>'>
                                    </asp:TextBox>
      
                                </td>
                            </tr>
                              
                        </table>
                        <table style="width: 100%">
                            <tr>
                                <td align="right">
                                    <asp:Button ID="Button1" ValidationGroup="SubmitInfo" CausesValidation="true" Text='<%# (Container is GridEditFormInsertItem) ? "Ajouter" : "Modifier" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button
                                    <asp:Button ID="Button2" Text="Annuler" runat="server" CausesValidation="False" CommandName="Cancel" >
                                    </asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
    please help me
    i have a Grid with template in this template i used ComboBox with DataSourceLinq
    when i execute there is no errors but when i want to update the template it give me an error :RadComboBox Error Selection out of range Parameter name: value
    i must do ?
  6. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 17 Sep 2011 Link to this post

    Hi Ks,

    Please check this code library which explains how to dead with this issue.
    There is a fully working sample project attached at the article.

    Regards,
    Kalina
    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
  7. Christophorus Donny
    Christophorus Donny avatar
    1 posts
    Member since:
    Jun 2016

    Posted 11 Oct in reply to Helen Link to this post

    Hi Halen

    I have following as your guideline ,when i debug before go through event ItemDataBound raise up error coming from on client side

    tableView.filter("DepartmentName", args.get_item().get_value(), "EqualTo");

    Still got error :

    Sys.WebForms.PageRequestManagerServerErrorException: Selection out of range
    Parameter name: value

    Please advise

     

     

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            ..........................
            combo.DataBind();
            combo.SelectedValue = e.Item.OwnerTableView.GetColumn("Name").CurrentFilterValue;
        }
    }

  8. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    287 posts

    Posted 14 Oct Link to this post

    Hello Christophorus,

    May I ask you to submit a support ticket and send along an isolated runnable sample project reproducing the problem observed?

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017