This is a migrated thread and some comments may be shown as answers.
Question about grid, GridDropDownColumn and RadComboBox
3 Answers 10 Views
This is a migrated thread and some comments may be shown as answers.
Marko
Top achievements
Rank 1
Marko asked on 21 Mar 2018, 01:10 PM

Hi
We are using telerik grid which is build dynamically. When adding GridDropDownColumn to the grid it's working without problem. But one functionality is really not OK. When user click on the item in grid to change it, drop-down opens but drop down values are already filtered to the existing values. Combo box should work in different way, as it works here: https://demos.telerik.com/aspnet-ajax/combobox/examples/overview/defaultcs.aspx. When user clicks on that drop-down and if there is any item selected, he gets all items in dropdown and NOT pre-filtered by selected value.



How should we set up that column to allow out of the box behaviour of the Filter?

               GridDropDownColumn ddCol = new GridDropDownColumn();
               ddCol.DataSourceID = column.Name + "ObjectDataSource";             
               ddCol.ListValueField = "ID";
               ddCol.ListTextField = "Name";
               ddCol.DataField = column.Name;
               ddCol.AllowAutomaticLoadOnDemand = true;
               ddCol.DropDownControlType = GridDropDownColumnControlType.RadComboBox;  

3 Answers, 1 is accepted

Sort by
0
Marko
Top achievements
Rank 1
answered on 21 Mar 2018, 02:02 PM

for update...

 

The same functionality is presented here: 

When user clicks on "Supplier" for edit, the drop-down is allready pre-filtered for selected value. We want to have unfiltered values, as standard Rad combo box.

0
Marko
Top achievements
Rank 1
answered on 21 Mar 2018, 02:03 PM
0
Attila Antal
Telerik team
answered on 26 Mar 2018, 06:04 PM
Hi Marko,

If I understand the request correctly, you do not want the RadComboBox to have pre-selected value when entering in Edit mode, is that correct?

In that case you can follow the approach from Accessing Controls in Edit/Insert Mode, bind the ItemDataBound event listener to RadGrid, access the RadComboBox within this event handler and clear the selection.
protected void Page_Init(object sender, EventArgs e)
{
        CreateGrid();
}
 
private void CreateGrid()
{
    RadGrid RadGrid1 = new RadGrid();
    RadGrid1.ID = "RadGrid1";
    RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
     
    GridDropDownColumn ddcol = new GridDropDownColumn();
    ddcol.DataField = "ShipCountry";
    ddcol.UniqueName = "ShipCountry";
    ddcol.HeaderText = "ShipCountry";
    ddcol.ListDataMember = "ShipCountry";
    ddcol.ListTextField = "ShipCountry";
    ddcol.ListValueField = "ShipCountry";
    RadGrid1.MasterTableView.Columns.Add(ddcol);
     
    // rest of the code
     
    PlaceHolder1.Controls.Add(RadGrid1);
}
 
private void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if(e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        var combo = (e.Item as GridEditableItem)["ShipCountry"].Controls[0] as RadComboBox;
        combo.Items.Insert(0, "All"); // You can even insert an item if you want
        combo.ClearSelection();
    }
}

Attached you can find a sample page demonstrating this scenario.

I hope this helps.

Kind regards,
Attila Antal
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Marko
Top achievements
Rank 1
Answers by
Marko
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or