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

radcombobox within filter template error

12 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 2
Veteran
Jon asked on 30 Aug 2011, 02:15 PM
i have a rad grid that has some rad combos in to filter data

<telerik:RadGrid ID="RadGridProducts" AllowSorting="True"
            AllowFilteringByColumn="true"
            DataSourceID="ObjDSProducts"
            AutoGenerateColumns="false"
            ShowStatusBar="true"
            CommandItemDisplay="Top"
            AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True"      
            AllowPaging="True" PageSize="10" runat="server" GridLines="None" Width="100%"
            EnableLinqExpressions="false">             
                    
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
             
            <MasterTableView DataKeyNames="Product_ID" AlternatingItemStyle-VerticalAlign="Top" ItemStyle-VerticalAlign="Top"  CommandItemDisplay="Top">
                <CommandItemSettings AddNewRecordImageUrl="~/connexassets/images/space.gif" AddNewRecordText="" ShowExportToExcelButton="true" />     
                <Columns>                   
                    <telerik:GridTemplateColumn DataField="Image" HeaderText="Image" AllowFiltering="false" UniqueName="Image" HeaderStyle-Width="45px" SortExpression="Group_Name">
                        <ItemTemplate><asp:Image runat="server" ID="PrdImg" ImageUrl='<%# String.Format("productresize.aspx?filename={0}&width=55", Eval("Image").ToString()) %>' Width="45px" BorderWidth="0" /></ItemTemplate>
                    </telerik:GridTemplateColumn>    
                    <telerik:GridBoundColumn UniqueName="Product_Code"  DataField="Code"  HeaderText="Code" AllowFiltering="false" HeaderStyle-Width="75px" />                       
                    <telerik:GridTemplateColumn AllowFiltering="true" DataField="Product_Title" HeaderText="Title" UniqueName="Product_Title" HeaderStyle-Width="225px" SortExpression="Product_Title">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="SqlTitleDS" DataTextField="Product_Title"
                                DataValueField="Product_Title" Height="200px" DropDownWidth="390px" Filter="StartsWith" Width="220px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Product_Title").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="Product_TitleIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlockTitle" runat="server">
 
                                <script type="text/javascript">
                                    function Product_TitleIndexChanged(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        tableView.filter("Product_Title", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                        <ItemTemplate>
                            <%#Eval("Product_Title")%>
                            <br /><asp:Label ID="lblProduct" Font-Bold="true" Font-Size="Smaller" Visible="true" runat="server" Text=""></asp:Label>                       
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>                   
                    <telerik:GridBoundColumn DataField="Product_Details"
                        HeaderText="Details"
                        SortExpression="Product_Details" UniqueName="Product_Details" Visible="false">
                    </telerik:GridBoundColumn>                                       
                    <telerik:GridTemplateColumn UniqueName="Product_Price" DataField="Product_Price" HeaderText="Price" AllowFiltering="false" HeaderStyle-Width="60px">
                        <ItemTemplate>
                            <asp:Label ID="lblShowWeb" Visible="true" runat="server" Text="" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn
                    <telerik:GridTemplateColumn AllowFiltering="true" DataField="Brand_Title" HeaderText="Brand" UniqueName="Brand_Title" HeaderStyle-Width="80px" SortExpression="Brand_Title">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxBrand" DataSourceID="SqlBrandDS" DataTextField="Brand_Title"
                                DataValueField="Brand_Title" Height="200px" DropDownWidth="215px" Width="165px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Brand_Title").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="Brand_NameIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlockBrand" runat="server">
 
                                <script type="text/javascript">
                                    function Brand_NameIndexChanged(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        tableView.filter("Brand_Title", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                        <ItemTemplate><%#Eval("Brand_Title")%></ItemTemplate>
                    </telerik:GridTemplateColumn>                   
                    <telerik:GridTemplateColumn UniqueName="ProductEditOptions" HeaderText="" HeaderStyle-Width="65px" AllowFiltering="false">
                        <ItemTemplate>
                            <asp:ImageButton ID="imgButEdit" runat="server" CausesValidation="true" AlternateText="Edit Product" CommandArgument='<%# Bind("Product_ID") %>' CommandName="Edit" ImageUrl="~/ConnexAssets/images/view.gif" />
                            <asp:ImageButton ID="imgbutdele" CommandArgument='<%# Bind("Product_ID") %>' runat="server" ImageUrl="~/ConnexAssets/images/delete.gif" OnClientClick="javascript:return confirm('Are you sure you want to permanently delete this product?');" CommandName="DeleteProduct" />                       
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>                                      
                </Columns>
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="Prod_ID, Rel_ID" DataSourceID="DSRelated" Width="100%" runat="server" CommandItemSettings-AddNewRecordText="Add Related Product" CommandItemDisplay="Top" ShowHeader="false" AllowFilteringByColumn="false" Name="Child">
                        <NoRecordsTemplate>No Related Products listed....</NoRecordsTemplate>
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="Prod_ID" MasterKeyField="Product_ID" />
                        </ParentTableRelation>
                        <AlternatingItemStyle BackColor="AliceBlue" />
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="RelatedProdName" ReadOnly="true" HeaderText="Related Product" Visible="true"  HeaderButtonType="TextButton" DataField="RelatedProdName" UniqueName="RelatedProdName" />
                            <telerik:GridButtonColumn ConfirmText="Delete this Related Product?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                <HeaderStyle Width="20px" />
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="RelatedProdName" SortOrder="Descending"></telerik:GridSortExpression>
                        </SortExpressions>
                        <EditFormSettings EditFormType="Template">               
                            <FormTemplate>
                                <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" style="border-collapse: collapse; background: white;">
                                    <tr>
                                        <td>
                                            <table id="Table3" cellspacing="1" cellpadding="1" border="0">
                                                <tr><td colspan="2"></td></tr>
                                                <tr>
                                                    <td valign="top">Product:</td>
                                                    <td>
                                                    <asp:DropDownList ID="RelProd_ID" runat="server" Width="586px"
                                                        DataSourceID="SqlDataSourceStock"
                                                        DataTextField="Product_Title" SelectedValue='<%# Bind("RelProd_ID") %>'
                                                        DataValueField="RelProd_ID" TabIndex="1" AppendDataBoundItems="True">
                                                        <asp:ListItem Selected="True" Text=" Select the product you wish to select as a related product " Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                       </td>
                                                </tr>
                                                <tr><td colspan="2"></td></tr>                                              
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <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>
                    </telerik:GridTableView>                   
                </DetailTables>
            </MasterTableView>           
             
        </telerik:RadGrid>

But fo you filter the product by title and then delete the product, if i try a rebind on the grid it fails as the selected value of the combo in the filter template no longer exists so it errors as follows:

System.ArgumentOutOfRangeException: Selection out of range Parameter name: value

Generated: Tue, 30 Aug 2011 11:29:16 GMT

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentOutOfRangeException: Selection out of range

Parameter name: value

   at Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource)

   at Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data)

   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

   at Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e)

   at Telerik.Web.UI.RadComboBox.PerformSelect()

   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

   at System.Web.UI.Control.DataBindChildren()

   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

   at System.Web.UI.Control.DataBind()

   at System.Web.UI.Control.DataBindChildren()

   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

   at System.Web.UI.Control.DataBind()

   at Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows)

   at Telerik.Web.UI.GridTableView.CreateFilteringItem(Boolean useDataSource, GridColumn[] copiedColumnSet, GridTHead thead)

   at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)

   at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)

   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)

   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)

   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

   at Telerik.Web.UI.GridTableView.PerformSelect()

   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

   at Telerik.Web.UI.GridTableView.DataBind()

   at Telerik.Web.UI.RadGrid.DataBind()

   at connex_site_products.RadGridProducts_ItemCommand(Object source, GridCommandEventArgs e) in G:\T4\connex\site_products.aspx.vb:line 56

   at Telerik.Web.UI.RadGrid.OnItemCommand(GridCommandEventArgs e)

   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)

   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)

   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

   at System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)

   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   --- End of inner exception stack trace ---

   at System.Web.UI.Page.HandleError(Exception e)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   at System.Web.UI.Page.ProcessRequest()

   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)

   at System.Web.UI.Page.ProcessRequest(HttpContext context)

   at ASP.connex_site_products_aspx.ProcessRequest(HttpContext context)

   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Heres my code behind page:

Protected Sub RadGridProducts_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridProducts.ItemCommand
        Select Case e.CommandName
            Case "DeleteProduct"
                ProductItems.Delete(e.CommandArgument)
                RadGridProducts.MasterTableView.DataBind()
            Case Telerik.Web.UI.RadGrid.ExportToExcelCommandName
                ConfigureExport()
                RadGridProducts.MasterTableView.ExportToExcel()
            Case "Edit"
                Response.Redirect("site_editproduct.aspx?id=" & e.CommandArgument & "&page=" & RadGridProducts.CurrentPageIndex & "&filter=" & RadGridProducts.MasterTableView.FilterExpression.ToString)
        End Select
    End Sub


Any ideas?







12 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 01 Sep 2011, 03:56 PM
Hi Jon,

From what I understand you delete the item by which you filtered on each filtering, therefore I do not see why you set the SelectedValue at all, as this value will never exist. You should better add an empty node or an unbound one to the combo and set it as selected.

All the best,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Jon
Top achievements
Rank 2
Veteran
answered on 01 Sep 2011, 04:05 PM
Hi Tsvetina,

Thanks for your reply, i am not sure i follow and maybe i didn't explain it properly.

If i simply call the page up and the grid returns rows and i select one to delete the code:

      Case "DeleteProduct"
                ProductItems.Delete(e.CommandArgument)
                RadGridProducts.MasterTableView.DataBind()

Works fine. But If i use the product title filter option and i filter so that the grid filters down only to show a single product and then I delete that product, the above code fails with the error I posted before. It may not be linked to the combo box but i wondered from looking at the error code that maybe it doesnt clear the selected item property of the radcombo on the rebind and then trys to find it but cant as the item has been deleted from the DB, the delete works fine.

does that make sense?
0
Tsvetina
Telerik team
answered on 02 Sep 2011, 02:03 PM
Hi Jon,

It is in your markup that the combo looks to select this value:
SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Product_Title").CurrentFilterValue %>'

If by deleting it from the grid datasource, you also delete it from the combo source (if they use and and the same table in the database), the combo cannot find it and may cause the exception.

Can you try removing the SelectedValue setting to confirm whether it causes the exception?

One other thing, if you are using a declarative datasource to bind the grid, do not call DataBind() in the code behind for rebinding the grid, use Rebind() instead.

Kind regards,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Jeff H.
Top achievements
Rank 1
answered on 30 Jan 2014, 05:33 PM
I have run into a similar situation.  I searched for a solution and came across this.  In my filter Combo I am using a separate datasource from the main grid.  If I try to remove the SelectedValue the delete will work but the filter will not after selecting an item.  It will not Select All because the OnClientSelectedIndexChanged will not fire since it is changed to All after the filter item is selected.  The grid column is shown below.  When the item is deleted I use the rebind to rebind the grid.


            <telerik:GridBoundColumn DataField="QuoteNo"
                FilterControlAltText="Filter QuoteNo column" HeaderText="Quote No"
                SortExpression="QuoteNo" UniqueName="QuoteNo">
                <FilterTemplate>
                    <telerik:RadComboBox ID="RadComboBoxQuoteNo" DataSourceID="QuoteFilterDS" DataTextField="QuoteNo" DropDownAutoWidth="Enabled"
                        DataValueField="QuoteNo" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("QuoteNo").CurrentFilterValue  %>'
                        runat="server" OnClientSelectedIndexChanged="function(sender,args){FilterIndexChanged(sender,args,'QuoteNo')}">
                        <Items>
                            <telerik:RadComboBoxItem Text="All" />
                        </Items>
                    </telerik:RadComboBox>
                </FilterTemplate>
            </telerik:GridBoundColumn>
0
Princy
Top achievements
Rank 2
answered on 31 Jan 2014, 09:14 AM
Hi Jeff,

In case you use a different DataSource to bind the RadComboBox in the filter template, there wont be any issue deleting the row, since it will be not deleted from RadComboBox source. Here is a sample code snippet i tried:

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AllowFilteringByColumn="True"  . . .>
    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" >
        <Columns>
           <telerik:GridBoundColumn UniqueName="ID" DataField="ID" HeaderText="ID">
           </telerik:GridBoundColumn>
           <telerik:GridBoundColumn DataField="ExamID" HeaderText="ExamID" UniqueName="ExamID">
               <FilterTemplate>
                   <telerik:RadComboBox ID="RadComboBoxQuoteNo" DataSourceID="SqlDataSource12" DataTextField="ExamID" DataValueField="ExamID" AppendDataBoundItems="true"
SelectedValue='<%#TryCast(Container,GridItem).OwnerTableView.GetColumn("ExamID").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="ExamIDIndexChanged">
                        <Items>
                            <telerik:RadComboBoxItem Text="All" />
                        </Items>
                    </telerik:RadComboBox>
                   <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                      <script type="text/javascript">
                        function ExamIDIndexChanged(sender, args) {
                          var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("ExamID", args.get_item().get_value(), "EqualTo");
                            }
                        </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
            </telerik:GridBoundColumn>    
            <telerik:GridEditCommandColumn ButtonType="ImageButton">
            </telerik:GridEditCommandColumn>
        </Columns>     
    </MasterTableView>  
</telerik:RadGrid>

Thanks,
Princy
0
Jeff H.
Top achievements
Rank 1
answered on 31 Jan 2014, 03:25 PM
As I mentioned in my post I use a different datasource for my data grid and my combobox.  In my scenario I use the Filter combobox to search for the record equal to my search item.  The result brings up one record.  If I delete that one record I receive the error.  If I delete the record from the unfiltered grid it works fine.
0
Eyup
Telerik team
answered on 04 Feb 2014, 03:13 PM
Hi Jeff,

I have created a sample RadGrid web site to test the described behavior. On my side both filtering and item delete work as expected. Can you please run the attached application and let me know about the result.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Jeff H.
Top achievements
Rank 1
answered on 21 Oct 2014, 04:24 PM
Eyup,

I also am having issues with the filter template,  I looked at your project and updated the Order ID column to a Filter Template as 

                    <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"
                        FilterControlAltText="Filter OrderID column" HeaderText="OrderID"
                        ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxOrderID" DataSourceID="SqlDataSource3" DataTextField="OrderID"
                                DataValueField="OrderID" runat="server" OnClientSelectedIndexChanged="OrderIDIndexChanged"
                                SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("OrderID").CurrentFilterValue %>'>
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                <script type="text/javascript">
                                    function OrderIDIndexChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("OrderID", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>

The data source is defined as 

        <asp:SqlDataSource ID="SqlDataSource3" runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT [OrderID] FROM [Orders]"></asp:SqlDataSource>

If I select an Order ID it will produce one record.  If I select Delete I get an error

Server Error in '/RadGridDelete' 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






0
Jeff H.
Top achievements
Rank 1
answered on 22 Oct 2014, 04:30 PM
I have also moved the Filter Template to the ShipName field as 

                    <telerik:GridBoundColumn DataField="ShipName"
                        FilterControlAltText="Filter ShipName column" HeaderText="ShipName"
                        SortExpression="ShipName" UniqueName="ShipName">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxShipName" DataSourceID="SqlDataSource3" DataTextField="ShipName"
                                DataValueField="ShipName" runat="server" OnClientSelectedIndexChanged="ShipNameIndexChanged"
                                SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ShipName").CurrentFilterValue %>'>
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                <script type="text/javascript">
                                    function ShipNameIndexChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("ShipName", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>

With the datasource as 

        <asp:SqlDataSource ID="SqlDataSource3" runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT DISTINCT ShipName FROM [Orders]"></asp:SqlDataSource>

If you select the Country filter then the ShipName filter for a result of a few rows when you delete the last row of that filtered data set this error appears.

Server Error in '/RadGridDelete' 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
Parameter name: 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) +33
   Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +1296
   Telerik.Web.UI.RadComboBox.PerformSelect() +37
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   Telerik.Web.UI.RadComboBox.DataBind() +70
   System.Web.UI.Control.DataBindChildren() +187
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +94
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.Control.DataBindChildren() +187
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +94
   System.Web.UI.Control.DataBind() +15
   Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +1304
   Telerik.Web.UI.GridTableView.CreateFilteringItem(Boolean useDataSource, GridColumn[] copiedColumnSet, GridTHead thead) +167
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +3070
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +1150
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +123
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
   Telerik.Web.UI.GridTableView.PerformSelect() +38
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   Telerik.Web.UI.GridTableView.DataBind() +388
   Telerik.Web.UI.GridTableView.Rebind() +117
   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +4892
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +205
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +147
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +121
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +156
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9528682
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446 

Do I need to change the filter expression?  Refresh the comboboxes?




0
Kostadin
Telerik team
answered on 24 Oct 2014, 09:24 AM
Hello Jeff,

Actually this is expected as you remove the only item from the RadComboBox and you have applied this item as a SelectedValue. If you remove this property the grid will not thrown an error but the selected value will not be disciplined in the dropdown.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jeff H.
Top achievements
Rank 1
answered on 24 Oct 2014, 01:58 PM
Kostadin,

I did not remove anything from the combobox the record was removed from the Grid.  I am trying to find out how I can get this to not error when the last row if a filtered grid is removed.  Especially when you may have more than two Filter Templates on a grid.

Jeff
0
Eyup
Telerik team
answered on 29 Oct 2014, 11:54 AM
Hi,

I suppose the discussed problem in ticket with ID: 872460 is related to this case. I hope that the solution provided in the mentioned thread has proven helpful.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Jon
Top achievements
Rank 2
Veteran
Answers by
Tsvetina
Telerik team
Jon
Top achievements
Rank 2
Veteran
Jeff H.
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Eyup
Telerik team
Kostadin
Telerik team
Share this question
or