Filter int32 filed in RadGridView according to textbox in main form

4 posts, 0 answers
  1. Emad
    Emad avatar
    3 posts
    Member since:
    Jul 2015

    Posted 18 Jan 2017 Link to this post

    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".

     

  2. Emad
    Emad avatar
    3 posts
    Member since:
    Jul 2015

    Posted 18 Jan 2017 in reply to Emad Link to this post

    No one to answer, or this is a silly question!!
  3. Emad
    Emad avatar
    3 posts
    Member since:
    Jul 2015

    Posted 19 Jan 2017 Link to this post

    Ok I solved the issue.
    bs.Filter = TableSituations.Columns[2].HeaderText.ToString() + " = " + int.Parse(txtInnovationID.Text);
    Thanks to Bryian Tan
  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 19 Jan 2017 Link to this post

    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.
Back to Top