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

[Solved] Adding Google Like Filtering for Radgrid Thru Grid Event

1 Answer 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Angelo Bradley
Top achievements
Rank 1
Angelo Bradley asked on 28 Jan 2010, 06:14 PM
I would like to build a composite component with Google like filtering.  Currently in my demo, I am adding the filtering in the code behind as below:

I am searching for a way to do this so that each developer will not have to add code like this in their code behind.  I was thinking about an event on the radgrid that will do this for me.  Any suggestions would be helpful

 

if (!IsPostBack)

 

{

dt = GetDataTable(

 

null,null);

 

 

 

this.rgContracts.MasterTableView.Columns.Clear();

 

 

 

 

MyCustomFilteringColumnCS DBA = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(DBA);

 

DBA.DataField =

 

"DBA Name";

 

DBA.HeaderText =

 

"DBA Name";

 

DBA.HeaderStyle.Width =

 

Unit.Pixel(200);

 

DBA.FilterControlWidth =

 

Unit.Pixel(175);

 

DBA.ItemStyle.ForeColor = System.Drawing.

 

Color.Blue;

 

DBA.ItemStyle.Font.Underline =

 

true;

 

 

 

MyCustomFilteringColumnCS ContractType = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(ContractType);

 

ContractType.DataField =

 

"Contract Type";

 

ContractType.HeaderText =

 

"Contract Type";

 

ContractType.HeaderStyle.Width =

 

Unit.Pixel(75);

 

ContractType.FilterControlWidth =

 

Unit.Pixel(55);

 

 

 

MyCustomFilteringColumnCS Clause = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(Clause);

 

Clause.DataField =

 

"Clause";

 

Clause.HeaderText =

 

"Clause";

 

Clause.HeaderStyle.Width =

 

Unit.Pixel(90);

 

Clause.FilterControlWidth =

 

Unit.Pixel(70);

 

Clause.ItemStyle.ForeColor = System.Drawing.

 

Color.Blue;

 

Clause.ItemStyle.Font.Underline =

 

true;

 

 

 

MyCustomFilteringColumnCS Notes = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(Notes);

 

Notes.DataField =

 

"Notes";

 

Notes.HeaderText =

 

"Notes";

 

Notes.HeaderStyle.Width =

 

Unit.Pixel(300);

 

Notes.FilterControlWidth =

 

Unit.Pixel(280);

 

 

 

MyCustomFilteringColumnCS Status = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(Status);

 

Status.DataField =

 

"Status";

 

Status.HeaderText =

 

"Status";

 

Status.HeaderStyle.Width =

 

Unit.Pixel(60);

 

Status.FilterControlWidth =

 

Unit.Pixel(40);

 

 

 

MyCustomFilteringColumnCS FC = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(FC);

 

FC.DataField =

 

"Future Condition";

 

FC.HeaderText =

 

"Future Condition";

 

FC.HeaderStyle.Width =

 

Unit.Pixel(86);

 

FC.FilterControlWidth =

 

Unit.Pixel(66);

 

 

 

MyCustomFilteringColumnCS BD = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(BD);

 

BD.DataFormatString =

 

"{0:d}";

 

BD.HtmlEncode =

 

false;

 

BD.DataField =

 

"Begin Date";

 

BD.HeaderText =

 

"Begin Date";

 

BD.HeaderStyle.Width =

 

Unit.Pixel(75);

 

BD.FilterControlWidth =

 

Unit.Pixel(55);

 

 

 

MyCustomFilteringColumnCS ED = new MyCustomFilteringColumnCS();

 

 

 

this.rgContracts.MasterTableView.Columns.Add(ED);

 

ED.DataFormatString =

 

"{0:d}";

 

ED.HtmlEncode =

 

false;

 

ED.DataField =

 

"End Date";

 

ED.HeaderText =

 

"End Date";

 

ED.HeaderStyle.Width =

 

Unit.Pixel(75);

 

ED.FilterControlWidth =

 

Unit.Pixel(55);

 

}

}

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 03 Feb 2010, 06:16 AM
Hello Angelo,

Our system indicates, that you have opened a support ticket on the same matter.
In order to avoid duplicate posts, we can continue our communication in the support ticket.

Regards,
Yavor
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Grid
Asked by
Angelo Bradley
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or