We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

filter for grid

Thread ID:

Created:

Updated:

Platform:

Replies:

59564 Apr 17,2007 01:33 PM UTC Apr 22,2007 08:51 PM UTC Windows Forms 5
loading
Tags: GridControl
Hrvoje
Asked On April 17, 2007 01:33 PM UTC

I'm using this code to filter data...
In comment area I would like to fill grid with filtered data. How?

string sFilter ="";
DataRow[] afrows = db.dataSetKolekcija.Akcioni.Select("Naziv LIKE '" + filter + "%'" );

if (afrows.Length != 0)
{
foreach (DataSetKolekcija.AkcioniRow arow in
afrows)
{
sFilter += arow;
// Here I would like to filter and fill grid...
}
}

Administrator [Syncfusion]
Replied On April 17, 2007 06:11 PM UTC

What grid do you want to use?

GridControl, GridDataBoundGrid, or GridGroupingControl?

Here is some code for a GridGroupingControl.

DataRow[] drs = dt.Select("[Col1] = 5");


DataTable newtable = new DataTable();
int c = 0;
foreach (object o in drs[0].ItemArray)
{
newtable.Columns.Add(new DataColumn(string.Format("col{0}", c++), o.GetType()));
}
foreach(DataRow dr in drs)
{
newtable.Rows.Add(dr.ItemArray);
}
this.gridGroupingControl1.DataSource = newtable;

Hrvoje Voda
Replied On April 20, 2007 10:29 PM UTC

This code is not good for me.
I'm using GridDataBoundGrid.

Administrator [Syncfusion]
Replied On April 20, 2007 11:23 PM UTC

In the code above, changing

this.gridGroupingControl1.DataSource = newtable;

to

this.gridDataboundGrid1.DataSource = newtable;

should put the rows into a GridDataBoundGrid.

Hrvoje Voda
Replied On April 21, 2007 09:49 AM UTC

I'm using it like that, but I get a grid with one empty row. No results.

Administrator [Syncfusion]
Replied On April 22, 2007 08:51 PM UTC

Here is a sample showing transferring a DataRow[] into a DataTable and setting it as the DataSource of a GridDataBoundGrid. What are you doing differently?

WindowsApplication1450.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;