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

[Solved] RadGrid Google Like Filter issue

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
doug
Top achievements
Rank 2
doug asked on 02 May 2013, 06:04 PM

 

 

I've implemented the grid google like filtering just find.  does what I need.  However, I need to add a checkbox column to allow the user to select which rows they want to save.

Once I include any type of MasterTableView with <column> the needdatasource overrides my column.  How can I add a custom column (checkbox) to the demo code at: 
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandcombo/defaultcs.aspx?product=grid#qsf-demo-source

<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" Width="560px" runat="server" OnColumnCreating="RadGrid1_ColumnCreating" OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid1_NeedDataSource" CellSpacing="0" GridLines="None">

<MasterTableView>

 <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

  <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">

 <HeaderStyle Width="20px"></HeaderStyle>

 </RowIndicatorColumn>

  <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">

 <HeaderStyle Width="20px"></HeaderStyle>

 </ExpandCollapseColumn>

  <Columns>

 <telerik:GridCheckBoxColumn DataType="System.Boolean" FilterControlAltText="Filter Allow" HeaderText="Allow" UniqueName="Allow">

 </telerik:GridCheckBoxColumn>

 </Columns>

  <EditFormSettings>

 <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

 </EditFormSettings>

  <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>

 </MasterTableView>

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 07 May 2013, 08:06 AM
Hello,

 The google-like filtering requires a custom column with specific filter controls to achieve the required behavior and the example in the demo clears all columns in advance before creating these custom filtering columns. You may need to modify the code of the google-like filtering demo in the Page_Load to avoid clearing columns defined in the markup. Also another option is to define all necessary columns in the code-behind in Page_Load where the custom filtering columns are crearted:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            dt = GetDataTable("SELECT Country, City, PostalCode FROM Customers");
            RadGrid1.MasterTableView.Columns.Clear();
            foreach (DataColumn dataColumn in dt.Columns)
            {
                MyCustomFilteringColumnCS gridColumn = new MyCustomFilteringColumnCS();
                RadGrid1.MasterTableView.Columns.Add(gridColumn);
                gridColumn.DataField = dataColumn.ColumnName;
                gridColumn.HeaderText = dataColumn.ColumnName;
            }
 
            var checkBoxColumn = new GridCheckBoxColumn();
            checkBoxColumn.UniqueName = "....";
            checkBoxColumn.HeaderText = "....";
            checkBoxColumn.DataType = typeof(bool);
            RadGrid1.MasterTableView.Columns.Add(checkBoxColumn);
        }
    }


Kind regards,
Marin
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
doug
Top achievements
Rank 2
Answers by
Marin
Telerik team
Share this question
or