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

filtering in grid with radcombox

6 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jols
Top achievements
Rank 2
Jols asked on 07 May 2009, 08:08 AM
hello once again to all expert on telerik,

                       Good day! i would like to ask again for help on configuring the radgrid with a radcombobox on a specific columns on my grid coz i wont be able to put a radcombo inside it, and how can i load the data on that combobox inside the so the user can select and also how can i get the selected value of the radcombo inside the grid please help

sample codes is highly appreciated

thanks to all

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 May 2009, 08:34 AM
Hello Jols,

You can check out the following document which explains on replacing the FilterTextBox with a DropDownList inorder to filter columns in the grid:
Filtering with MS DropDownList instead of textbox

Thanks
Princy.
0
Jols
Top achievements
Rank 2
answered on 07 May 2009, 09:33 AM
hello sir,

            Good day! i apologize on the link that you have given i tried to follow but still there is an error on the class..is there any simple sample codes on how to embed radcombobox as a filter option inside the grid to a specific column..please help..

sample codes is highly appreciated

thanks
0
Jols
Top achievements
Rank 2
answered on 08 May 2009, 07:14 AM
sir princy this my codes but the value of the radcombobox upon creating is null..so i'm having an nullexemption error..anyway here's my code please revised or recodes if missed something..please help

protected void dgDTL_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridFilteringItem) 
            { 
                DataSet ds = SqlHelper.ExecuteDataset(gConn.SQLConnection,    CommandType.Text, "select fcISTResponseMsg from tblISTResponseCode"); 
                GridFilteringItem filteringItem = e.Item as GridFilteringItem; 
                //RadComboBox orderIdBox = filteringItem["fcISTResponseMsg"].Controls[0] as RadComboBox; 
                RadComboBox orderIdBox =(e.Item as GridFilteringItem).Cells[13].Controls[0] as RadComboBox;   --i'm having null here...
                orderIdBox.DataSource = ds
                orderIdBox.DataTextField = "fcISTResponseMsg"
                orderIdBox.DataBind(); 
                orderIdBox.Width = Unit.Pixel(50); 
               
            } 
        } 

sample codes is highly appreciated
thanks
0
asilioni
Top achievements
Rank 1
answered on 24 Feb 2012, 12:11 PM
Hi,
I am using a radcombobox for filtering radgrid. The filter works fine but after the selection of the radcombobox, it looses the selected value. This is probably happens because in the ItemDataBound event the radcombobox is populated again with the values. How can i keep the selected value?

Thanks a lot,
Angie
if (e.Item.ItemType == GridItemType.FilteringItem)
                        {
                            //
                            //Fill in the Consultation status ComboBox filter
                            //
                            GridFilteringItem filterItem = (GridFilteringItem)e.Item;
                            RadComboBox combo = (RadComboBox)filterItem["ConsultStatus"].FindControl("cboIcon");
 
                            RadComboBoxItem item = new RadComboBoxItem("");
                            combo.Items.Add(item);
 
                            item = new RadComboBoxItem("Όλα");
                            item.Value = "5";
                            combo.Items.Add(item);
}

0
Princy
Top achievements
Rank 2
answered on 24 Feb 2012, 02:04 PM
Hello,

Take a look into the following demo which discuss the same.
Grid / Filtering Template Columns

Thanks,
Princy.
0
asilioni
Top achievements
Rank 1
answered on 05 Mar 2012, 01:53 PM
<FilterTemplate>
                                <telerik:RadComboBox runat="server"
                                 ID="cboIcon"
                                 DataTextField="ConsultStatus"
                                 Text='<% Eval("ConsultStatus")%>'
                                 DataValueField="ConsultStatus"
                                 OnClientSelectedIndexChanged="IconIndexChanged"
                                 OnSelectedIndexChanged="cboIcon_SelectedIndexChanged">                            
                                </telerik:RadComboBox>
                                 
                                <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
 
                                <script type="text/javascript">
                                    function IconIndexChanged(sender,args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        var filterVal = args.get_item().get_value();                                                                                  
                                             
                                        if (filterVal == "0") {
                                            tableView.filter("ConsultStatus", "Σε εξέλιξη", "EqualTo");
                                        }
                                        else if (filterVal == "1") {
                                            tableView.filter("ConsultStatus", "Υπό έγκριση", "EqualTo");
                                        }
                                        else if (filterVal == "2") {
                                            tableView.filter("ConsultStatus", "Προς δημιουργία εγκυκλίου", "EqualTo");
                                        }
                                        else if (filterVal == "3") {
                                            tableView.filter("ConsultStatus", "Κλειστές", "EqualTo");
                                        }
                                        else if (filterVal == "4") {
                                            tableView.filter("ConsultStatus", "Ακυρωμένες", "EqualTo");
                                        }
                                        
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
 
                                </FilterTemplate>
Hi Princy,
I read your suggestion but i am using a completely different way in my rad combobox. In my case, each radcombobox item, contains an image and a title, that's why i fill in the radcombobox in the ItemDataBound event (so i can set the Item.Image value). Is there a way to keep the selected value?
Thanks again,
Angie
Tags
Grid
Asked by
Jols
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Jols
Top achievements
Rank 2
asilioni
Top achievements
Rank 1
Share this question
or