468,321 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Filtering problem.... urgent please help

Ubi
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!

Nov 16 '05 #1
6 1239
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.CurrentRo ws

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:EB**********************************@microsof t.com...
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!

Nov 16 '05 #2
Ubi
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" wrote:
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.CurrentRo ws

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:EB**********************************@microsof t.com...
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!


Nov 16 '05 #3
Ubi
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" wrote:
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.CurrentRo ws

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:EB**********************************@microsof t.com...
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!


Nov 16 '05 #4
Disappears only the changed row or all rows disappear?
"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:BA**********************************@microsof t.com...
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" wrote:
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.CurrentRo ws

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:EB**********************************@microsof t.com...
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!


Nov 16 '05 #5
No idea, after changing the lastname to 'bla bla bla' control if the the row
firstname is still 'A'

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:C0**********************************@microsof t.com...
Only the changed row disappear...

"Zürcher See" wrote:
Disappears only the changed row or all rows disappear?
"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:BA**********************************@microsof t.com...
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" wrote:

> 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.CurrentRo ws
>
> "Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
> news:EB**********************************@microsof t.com...
> > 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!
> >
>
>
>


Nov 16 '05 #6
Ubi
OK, thanks anyway

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

"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:C0**********************************@microsof t.com...
Only the changed row disappear...

"Zürcher See" wrote:
Disappears only the changed row or all rows disappear?
"Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
news:BA**********************************@microsof t.com...
> 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" wrote:
>
> > 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.CurrentRo ws
> >
> > "Ubi" <Ub*@discussions.microsoft.com> schrieb im Newsbeitrag
> > news:EB**********************************@microsof t.com...
> > > 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!
> > >
> >
> >
> >


Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Alex Ayzin | last post: by
2 posts views Thread by micka | last post: by
3 posts views Thread by =?Utf-8?B?QXJseW5fTA==?= | last post: by
4 posts views Thread by Goran Djuranovic | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.