Disable/Remove a radcomboboxItem when not required

2 posts, 0 answers
  1. Subhashini
    Subhashini avatar
    35 posts
    Member since:
    Oct 2014

    Posted 01 Apr 2015 Link to this post

    This post exactly explains my situation but instead of removing the Boolean value yes, I need to disable a radcombo item (please check under Rad comboBox filter2 item Show All Temporary reports).
    http://www.telerik.com/forums/combobox-with-textbox-filtering 
    Rad comboBox filter1:
    <telerik:GridBoundColumn UniqueName="STATE_CODE" DataField="STATE_CODE" HeaderText="STATE_CODE" >
                            <FilterTemplate>
                                <telerik:RadComboBox ID="RadComboBoxSTATE_CODE" DataSourceID="SqlDataSource1" DataTextField="STATE_CODE"
                                    DataValueField="STATE_CODE" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("STATE_CODE").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="STATE_CODEIndexChanged">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="All" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                    <script type="text/javascript">

                                        function STATE_CODEIndexChanged(sender, args) {

                                            var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");

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

                                        }

                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>

    Rad comboBox filter2:
       <telerik:GridBoundColumn UniqueName="report" DataField="report" HeaderText="report" >
                            <FilterTemplate>
                                <telerik:RadComboBox ID="RadComboBoxreport" DataSourceID="SqlDataSource2" DataTextField="report"
                                    DataValueField="report" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("report").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="reportIndexChanged">
                                    <Items>
                                        <telerik:RadComboBoxItem Value="All" Text="All" />
                                        <telerik:RadComboBoxItem Value="T" Text="Show All Temporary reports" Enabled="true" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                    <script type="text/javascript">

                                        function reportIndexChanged(sender, args) {

                                            var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");

                                            tableView.filter("report", args.get_item().get_value(), "Contains");

                                        }

                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
    Temp Report numbers start with T. Regulars do not have T.
    On selecting a state, say CA, if they have temp reports, it is working fine. If CA doesn't have temporary reports, but the user chooses "Show all temp records", I get ArgumentOutofRangeException and - Selection out of range Parameter name: value error.
    I am not sure where to disable the item.  It will be great if I get some help on this.

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 06 Apr 2015 Link to this post

    Hi Subhashini,

    Have you tried any of the posted suggestions? The error you get tell you that item you are trying to access does not exist.

    Regards,
    Hristo Valyavicharski
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top