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

Filter int32 filed in RadGridView according to textbox in main form

3 Answers 26 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emad
Top achievements
Rank 1
Emad asked on 18 Jan 2017, 10:38 AM

I have a main form frmInnovation that contains a textbox txtInnovationID, and I have a Telerik RadGridView on the form TableSituations with a column InnovationNameID of type int32.
What I want to do is to filter the RadGridView on form load according to the txtInnovationID.

TableSituation.InnovationNameID = txtInnovationID

 

I use this code to filter strings, but how to modify to filter int32.

BindingSource bs = new BindingSource();
bs.DataSource = TableSituations.DataSource;
bs.Filter = TableSituations.Columns[2].HeaderText.ToString() + " LIKE '%" + txtInnovationID.Text + "%'";
TableSituations.DataSource = bs.DataSource;

I need also to change the code from "LIKE" to "Equals".

 

3 Answers, 1 is accepted

Sort by
0
Emad
Top achievements
Rank 1
answered on 18 Jan 2017, 06:08 PM
No one to answer, or this is a silly question!!
0
Emad
Top achievements
Rank 1
answered on 19 Jan 2017, 12:35 PM
Ok I solved the issue.
bs.Filter = TableSituations.Columns[2].HeaderText.ToString() + " = " + int.Parse(txtInnovationID.Text);
Thanks to Bryian Tan
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Jan 2017, 02:06 PM
Hello Emad,

Thank you for writing.  

I am glad that the problem you were facing is now resolved.

Note that it is suitable to use the custom filtering functionality that RadGridView supports. Additional information is available here: http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering

Please refer to our Demo application >> GridView >> Filtering >> Custom Filtering example. The demo application is available in the installation folder of the suite which is usually located the at following path: C:\Program Files (x86)\Telerik\UI for WinForms R3 2016\Examples\QuickStart\Bin.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Emad
Top achievements
Rank 1
Answers by
Emad
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or