Question Filter int32 filed in RadGridView according to textbox in main form

emad981

New member
Joined
Jan 18, 2017
Messages
1
Programming Experience
Beginner
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.
C#:
 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".
 
Think it through. As you say, you need to use an equality operator instead of LIKE. That means removing the wildcards, which only apply to the LIKE operator. You also need to remove the delimiters for the string value if you're not using a string. Do those three things and you're done.
 
Back
Top Bottom