filter for grid
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...
}
}
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...
}
}
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
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.
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;
HV
Hrvoje Voda
April 20, 2007 10:29 PM UTC
This code is not good for me.
I'm using GridDataBoundGrid.
I'm using GridDataBoundGrid.
AD
Administrator
Syncfusion Team
April 20, 2007 11:23 PM UTC
In the code above, changing
to
should put the rows into a GridDataBoundGrid.
this.gridGroupingControl1.DataSource = newtable;
to
this.gridDataboundGrid1.DataSource = newtable;
should put the rows into a GridDataBoundGrid.
HV
Hrvoje Voda
April 21, 2007 09:49 AM UTC
I'm using it like that, but I get a grid with one empty row. No results.
AD
Administrator
Syncfusion Team
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
WindowsApplication1450.zip
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
HR Hrvoje
- Apr 17, 2007 01:33 PM UTC
- Apr 22, 2007 08:51 PM UTC