Selection out of range Parameter name: value (radCombobox in radgrid)

5 posts, 1 answers
  1. cimscims
    cimscims avatar
    14 posts
    Member since:
    Jul 2010

    Posted 03 Aug 2010 Link to this post

    I am getting the error "Selection out of range Parameter name: value". I have a radcombobox inside a FormTemplate in the radgrid.
    Find the code for reference.

    <telerik:RadGrid AutoGenerateColumns="False" ID="rgModel" Skin="WebBlue"  
            AllowPaging="True" runat="server" OnItemDataBound="rgModel_ItemDataBound">
            <PagerStyle Mode="NextPrevAndNumeric" />                            
            <MasterTableView DataKeyNames="ModelId" CommandItemDisplay="Top" CommandItemSettings-ShowRefreshButton="false">
                <Columns>      
                        <telerik:GridEditCommandColumn  UniqueName="EditCommandColumn1" ButtonType="ImageButton" >
                        <HeaderStyle Width="20px" />                                                                                                                                               
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>                                                       
                    <telerik:GridBoundColumn HeaderText="Manufacturer" DataField="Manufacturer"
                        UniqueName="Manufacturer" HeaderStyle-HorizontalAlign="left" />
                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" ConfirmText="Do You want to delete the Manufacturer?">
                    </telerik:GridButtonColumn>                          
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>                   
                        <table id="Table3" cellspacing="1" cellpadding="1" width="500" border="0" class="module">                                                                                                                                                                                                                  
                            <tr>
                                <td>Manufacturer:</td>
                                <td>
                                    <telerik:RadComboBox ID="ddlManufacturer" AppendDataBoundItems="true" runat="server" Skin="WebBlue"                                                          
                                        SelectedValue='<%# Bind("ManufacturerId")%>'>                                                           
                                    </telerik:RadComboBox
                                </td>
                            </tr>                                                                                                  
                            <tr>
                                <td> </td>
                                <td>
                                        <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                        runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                    </asp:Button
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>                                      
                    </FormTemplate>
                </EditFormSettings>                    
            </MasterTableView>
        </telerik:RadGrid>           
      
    Protected Sub rgModel_ItemDataBound(ByVal source As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
            Dim blnReturn As Boolean
            Dim strErrMsg As String = String.Empty
            Dim interrno As Integer
            Dim dtbManufacturer As New DataTable
            
      
            If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then
      
                Dim ddlManufacturer As Telerik.Web.UI.RadComboBox = e.Item.FindControl("ddlManufacturer")
                
                blnReturn = _objW.GetManufacturers(dtbManufacturer)
      
                If Equals(blnReturn, True) Then
        ddlManufacturer.Items.Clear()
        ddlManufacturer.SelectedValue = Nothing
                    ddlManufacturer.DataSource = dtbManufacturer
                    ddlManufacturer.DataTextField = dtbManufacturer.Columns(1).ColumnName
                    ddlManufacturer.DataValueField = dtbManufacturer.Columns(0).ColumnName
                    ddlManufacturer.DataBind()
                End If
            End If
        End Sub
  2. cimscims
    cimscims avatar
    14 posts
    Member since:
    Jul 2010

    Posted 04 Aug 2010 Link to this post

    Any ideas?
  3. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Aug 2010 Link to this post

    Hello,

    You could set the SelectedValue directly from code-behind like below and check whether this eliminates the error.

    VB.Net:
    ddlManufacturer.Items.Clear()
    ddlManufacturer.SelectedValue = Nothing
    ddlManufacturer.DataSource = dtbManufacturer
    ddlManufacturer.DataTextField = dtbManufacturer.Columns(1).ColumnName
    ddlManufacturer.DataValueField =dtbManufacturer.Columns(0).ColumnName
    ddlManufacturer.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "ManufacturerId").ToString(), String)
    ddlManufacturer.DataBind()

    Thanks,
    Princy.
  4. cimscims
    cimscims avatar
    14 posts
    Member since:
    Jul 2010

    Posted 05 Aug 2010 Link to this post

    Thank you very much Princy. It worked fine...
  5. Leidi
    Leidi avatar
    1 posts
    Member since:
    Jan 2018

    Posted 15 Jan 2018 Link to this post

    Please help me! I don't understand this error:

    Error de servidor en la aplicación '/'.

    Selection out of range
    Nombre del parámetro: value
    Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.

    Detalles de la excepción: System.ArgumentOutOfRangeException: Selection out of range
    Nombre del parámetro: value

    Error de código fuente:

    Se ha generado una excepción no controlada durante la ejecución de la solicitud Web actual. La información sobre el origen y la ubicación de la excepción pueden identificarse utilizando la excepción del seguimiento de la pila siguiente.
    Seguimiento de la pila:

    [ArgumentOutOfRangeException: Selection out of range Nombre del parámetro: value] Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +191 Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +510 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34 Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +1296 Telerik.Web.UI.RadComboBox.PerformSelect() +37 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 Telerik.Web.UI.RadComboBox.DataBind() +71 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +114 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22 Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +36 Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +90 System.Web.UI.Control.PreRenderRecursiveInternal() +88 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +883

     

Back to Top