Filtering problem.... urgent please help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
i have a problem with System.Data.DataViewRowState.

i have a ReadOnly datagrid,
a dataView and a dataTable.

i'm using the dataView's filter property to filter the data (firstName =
'Dani').
the problem is that i don't understanh how the ViewRowState works:
i have an external form that changes the value of the dataTable.
when it changes a row (even when the firstName col is not changed). the row
disappears; when a row that wasn't in the view before (because it's name want
Danni) changes to firstName->Danni, it doesn't appear in the view although it
should be...

please please help!
 
Each DataRow has the readonly property RowState.
When you change a value in a row, also the RowState is changed to "Modified"
If you add a row, this row will have a RowState="Added "
If you delete a row, this row will be marked as "Deleted"

If you call the AcceptChages() method of the DataRow/DataTable, all the
chages made to the rows will take place and all the state of the rows are
set to "Unchanged"
If you call the RejectChages() method of the DataRow/DataTable, all the
chages made to the rows will be discarded and all the state of the rows are
set to "Unchanged"

DataView is able to filter also the RowState, if you are not intrested to
filter the rowstate set the
DataView.RowStateFilter=DataViewRowState.CurrentRows
 
this is now working...

my code is something like
dataTable dt = new DataTable("tbl");
dataView dv = new DataView();
dv.Table = dt;

dt.Colums.Add("firstName");
dt.Colums.Add("lastName");

dataRow dr = dt.NewRow();

dv.Filter = "firstName = 'A'";

dr["firstName"]="A";
dr["lastName'']="bla bla";
dt.Rows.Add(dr);

dataGrid1.dataSource = dv;

NOW, THIS ROW WILL BE SHOWN, BUT IF I SO SOMETHING LIKE:
dr = dt.Rows[0];
dr["lastName"] = "bla bla bla bla";
dt.AcceptChanges();

THE ROW WILL DISAPPEAR (even thought i didn't change the first name at all).
I've tried using : dv.RowStateView = Current but it didn't work...

please help
 
this is now working...

my code is something like
dataTable dt = new DataTable("tbl");
dataView dv = new DataView();
dv.Table = dt;

dt.Colums.Add("firstName");
dt.Colums.Add("lastName");

dataRow dr = dt.NewRow();

dv.Filter = "firstName = 'A'";

dr["firstName"]="A";
dr["lastName'']="bla bla";
dt.Rows.Add(dr);

dataGrid1.dataSource = dv;

NOW, THIS ROW WILL BE SHOWN, BUT IF I SO SOMETHING LIKE:
dr = dt.Rows[0];
dr["lastName"] = "bla bla bla bla";
dt.AcceptChanges();

THE ROW WILL DISAPPEAR (even thought i didn't change the first name at all).
I've tried using : dv.RowStateView = Current but it didn't work...

please help
 
Disappears only the changed row or all rows disappear?


Ubi said:
this is now working...

my code is something like
dataTable dt = new DataTable("tbl");
dataView dv = new DataView();
dv.Table = dt;

dt.Colums.Add("firstName");
dt.Colums.Add("lastName");

dataRow dr = dt.NewRow();

dv.Filter = "firstName = 'A'";

dr["firstName"]="A";
dr["lastName'']="bla bla";
dt.Rows.Add(dr);

dataGrid1.dataSource = dv;

NOW, THIS ROW WILL BE SHOWN, BUT IF I SO SOMETHING LIKE:
dr = dt.Rows[0];
dr["lastName"] = "bla bla bla bla";
dt.AcceptChanges();

THE ROW WILL DISAPPEAR (even thought i didn't change the first name at all).
I've tried using : dv.RowStateView = Current but it didn't work...

please help


Zürcher See said:
Each DataRow has the readonly property RowState.
When you change a value in a row, also the RowState is changed to "Modified"
If you add a row, this row will have a RowState="Added "
If you delete a row, this row will be marked as "Deleted"

If you call the AcceptChages() method of the DataRow/DataTable, all the
chages made to the rows will take place and all the state of the rows are
set to "Unchanged"
If you call the RejectChages() method of the DataRow/DataTable, all the
chages made to the rows will be discarded and all the state of the rows are
set to "Unchanged"

DataView is able to filter also the RowState, if you are not intrested to
filter the rowstate set the
DataView.RowStateFilter=DataViewRowState.CurrentRows

the
row name
want although
it
 
No idea, after changing the lastname to 'bla bla bla' control if the the row
firstname is still 'A'

Ubi said:
Only the changed row disappear...

Zürcher See said:
Disappears only the changed row or all rows disappear?


Ubi said:
this is now working...

my code is something like
dataTable dt = new DataTable("tbl");
dataView dv = new DataView();
dv.Table = dt;

dt.Colums.Add("firstName");
dt.Colums.Add("lastName");

dataRow dr = dt.NewRow();

dv.Filter = "firstName = 'A'";

dr["firstName"]="A";
dr["lastName'']="bla bla";
dt.Rows.Add(dr);

dataGrid1.dataSource = dv;

NOW, THIS ROW WILL BE SHOWN, BUT IF I SO SOMETHING LIKE:
dr = dt.Rows[0];
dr["lastName"] = "bla bla bla bla";
dt.AcceptChanges();

THE ROW WILL DISAPPEAR (even thought i didn't change the first name at all).
I've tried using : dv.RowStateView = Current but it didn't work...

please help


:

Each DataRow has the readonly property RowState.
When you change a value in a row, also the RowState is changed to "Modified"
If you add a row, this row will have a RowState="Added "
If you delete a row, this row will be marked as "Deleted"

If you call the AcceptChages() method of the DataRow/DataTable, all the
chages made to the rows will take place and all the state of the
rows
are
set to "Unchanged"
If you call the RejectChages() method of the DataRow/DataTable, all the
chages made to the rows will be discarded and all the state of the
rows
are
set to "Unchanged"

DataView is able to filter also the RowState, if you are not
intrested
to
filter the rowstate set the
DataView.RowStateFilter=DataViewRowState.CurrentRows

hi
i have a problem with System.Data.DataViewRowState.

i have a ReadOnly datagrid,
a dataView and a dataTable.

i'm using the dataView's filter property to filter the data
(firstName
=
'Dani').
the problem is that i don't understanh how the ViewRowState works:
i have an external form that changes the value of the dataTable.
when it changes a row (even when the firstName col is not
changed).
the
row
disappears; when a row that wasn't in the view before (because
it's
name
want
Danni) changes to firstName->Danni, it doesn't appear in the view although
it
should be...

please please help!
 
OK, thanks anyway

Zürcher See said:
No idea, after changing the lastname to 'bla bla bla' control if the the row
firstname is still 'A'

Ubi said:
Only the changed row disappear...

Zürcher See said:
Disappears only the changed row or all rows disappear?


this is now working...

my code is something like
dataTable dt = new DataTable("tbl");
dataView dv = new DataView();
dv.Table = dt;

dt.Colums.Add("firstName");
dt.Colums.Add("lastName");

dataRow dr = dt.NewRow();

dv.Filter = "firstName = 'A'";

dr["firstName"]="A";
dr["lastName'']="bla bla";
dt.Rows.Add(dr);

dataGrid1.dataSource = dv;

NOW, THIS ROW WILL BE SHOWN, BUT IF I SO SOMETHING LIKE:
dr = dt.Rows[0];
dr["lastName"] = "bla bla bla bla";
dt.AcceptChanges();

THE ROW WILL DISAPPEAR (even thought i didn't change the first name at
all).
I've tried using : dv.RowStateView = Current but it didn't work...

please help


:

Each DataRow has the readonly property RowState.
When you change a value in a row, also the RowState is changed to
"Modified"
If you add a row, this row will have a RowState="Added "
If you delete a row, this row will be marked as "Deleted"

If you call the AcceptChages() method of the DataRow/DataTable, all the
chages made to the rows will take place and all the state of the rows
are
set to "Unchanged"
If you call the RejectChages() method of the DataRow/DataTable, all the
chages made to the rows will be discarded and all the state of the rows
are
set to "Unchanged"

DataView is able to filter also the RowState, if you are not intrested
to
filter the rowstate set the
DataView.RowStateFilter=DataViewRowState.CurrentRows

hi
i have a problem with System.Data.DataViewRowState.

i have a ReadOnly datagrid,
a dataView and a dataTable.

i'm using the dataView's filter property to filter the data (firstName
=
'Dani').
the problem is that i don't understanh how the ViewRowState works:
i have an external form that changes the value of the dataTable.
when it changes a row (even when the firstName col is not changed).
the
row
disappears; when a row that wasn't in the view before (because it's
name
want
Danni) changes to firstName->Danni, it doesn't appear in the view
although
it
should be...

please please help!
 
Back
Top