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.

filter for grid

Thread ID:

Created:

Updated:

Platform:

Replies:

59564 Apr 17,2007 09:33 AM Apr 22,2007 04:51 PM Windows Forms 5
loading
Tags: GridControl
Hrvoje
Asked On April 17, 2007 09:33 AM

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 02:11 PM

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 06:29 PM

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

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

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 05:49 AM

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

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

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.

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.

;