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

Filter with GridCheckBoxColumn not work.

1 Answer 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dharmesh Barochia
Top achievements
Rank 1
Dharmesh Barochia asked on 12 Oct 2009, 12:22 PM

When I try to apply AutoPostBackOnFilter="true" inside GridCheckBoxColumn with Telerik Grid it not filter when I change filter value.

And also I notice that it always include checkbox filter value when I change other column’s filter value.

 

Ex.

ContactPerson  City                      Country                IsMainAddress?

Dharmesh           Rajkot                   India                      True

Vishal                  Connecticut          USA                       False

Vimal                   Baroda                 India                      True

 

 

           (1)    AutoPostBackOnFilter not works with GridCheckBoxColumn, here my last column IsMainAddress is GridCheckBoxColumn.

           (2)   When I try to filter ContactPerson with “Vi” and apply Contains filter it displays only “Vishal, Connecticut, USA, False”    

                 because it added “IsMainAddress?” column’s default fitter value False that should not be.


           It should be display “Vishal” and “Vimal” records, this work well other then CheckBoxColumn value. I hope this can be solving 

          using some differemt method.

1 Answer, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 15 Oct 2009, 01:31 PM
Hi Dharmesh,

I am not quite sure if AutoPostBackOnFilter functionality for GridCheckBoxColumn is supported out of the box. However i found a help topic describing how to implement such functionality using DropDownList:

http://www.telerik.com/help/aspnet-ajax/grdfilteringforchecboxcolumn.html

I also tried to reproduce the (2) issue from your post but I failed. Here is my code:

<asp:ScriptManager runat="server" ID="ScriptManager1"
        </asp:ScriptManager> 
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true" 
            OnNeedDataSource="RadGrid1_NeedDataSource"
            <MasterTableView> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="ContactPerson" UniqueName="ContactPerson" HeaderText="ContactPerson"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="City" UniqueName="City" HeaderText="City"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Country" UniqueName="Country" HeaderText="Country"
                    </telerik:GridBoundColumn> 
                    <telerik:GridCheckBoxColumn DataField="IsMainAddress" UniqueName="IsMainAddress" 
                        HeaderText="IsMainAddress"
                    </telerik:GridCheckBoxColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 

As you see i use advanced data binding:

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
        DataTable table = new DataTable(); 
        table.Columns.Add("ContactPerson"); 
        table.Columns.Add("City"); 
        table.Columns.Add("Country"); 
        table.Columns.Add("IsMainAddress"typeof(bool)); 
        table.Rows.Add("Dharmesh""Rajkot""India"true); 
        table.Rows.Add("Vishal""Connecticut""USA"false); 
        table.Rows.Add("Vimal""Baroda""India"true); 
        RadGrid1.DataSource = table; 
    } 


Thanks
Johny





Tags
Grid
Asked by
Dharmesh Barochia
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Share this question
or