By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

Binding a textbox to a dataview

P: n/a
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Paul,

If you are not using binding context, then how are you binding to the
data set? The DataBindings collection and the BindingContext classes are
tied together, and you can't really have one without the other.

What exactly are you doing in order to create a data binding?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??
any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #2

P: n/a
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView, "RailGapIndicatorId" );

and I change the view in the textbox based on the currently selected item in a combobox on the same form:

this.rgiDataView.RowFilter = "BlockOrOLId = '" + this.blockIdComboBox.SelectedValue + "'";

when I change the selection in the combobox, the text in the text box changes correctly, but when I change text in the textbox the changes aren't reflected in the dataset. Am I doing something fundamentaly wrong?

If I do exactly the same thing but binding to a datagrid rather than the textbox it updates the dataset correctly
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

If you are not using binding context, then how are you binding to the
data set? The DataBindings collection and the BindingContext classes are
tied together, and you can't really have one without the other.

What exactly are you doing in order to create a data binding?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
I have a textbox bound to a dataview, when I update the text in the

textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the

datasets, i.e lots of child tables etc, I cannot use bindingcontext


Nov 16 '05 #3

P: n/a
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView, "RailGapIndicatorId" );
and I change the view in the textbox based on the currently selected item in a combobox on the same form:
this.rgiDataView.RowFilter = "BlockOrOLId = '" + this.blockIdComboBox.SelectedValue + "'";
when I change the selection in the combobox, the text in the text box changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?
If I do exactly the same thing but binding to a datagrid rather than the textbox it updates the dataset correctly

"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

If you are not using binding context, then how are you binding to the data set? The DataBindings collection and the BindingContext classes are tied together, and you can't really have one without the other.

What exactly are you doing in order to create a data binding?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
I have a textbox bound to a dataview, when I update the text in the

textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the

datasets, i.e lots of child tables etc, I cannot use bindingcontext


Nov 16 '05 #4

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!

"Paul Slavin" wrote:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #5

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,

"RailGapIndicatorId" );

and I change the view in the textbox based on the currently selected item

in a combobox on the same form:

this.rgiDataView.RowFilter = "BlockOrOLId = '" +

this.blockIdComboBox.SelectedValue + "'";

when I change the selection in the combobox, the text in the text box

changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?

If I do exactly the same thing but binding to a datagrid rather than the

textbox it updates the dataset correctly


"Nicholas Paldino [.NET/C# MVP]" wrote:

> Paul,
>
> If you are not using binding context, then how are you binding to

the
> data set? The DataBindings collection and the BindingContext classes

are
> tied together, and you can't really have one without the other.
>
> What exactly are you doing in order to create a data binding?
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> news:B9**********************************@microsof t.com...
> > I have a textbox bound to a dataview, when I update the text in the
> textbox no changes take place in the underlying dataset. Why is this??
> >
> > any answers appreciated, as to due to the underlying structure of the
> datasets, i.e lots of child tables etc, I cannot use bindingcontext
> >
>
>
>


Nov 16 '05 #6

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,

"RailGapIndicatorId" );

and I change the view in the textbox based on the currently selected item

in a combobox on the same form:

this.rgiDataView.RowFilter = "BlockOrOLId = '" +

this.blockIdComboBox.SelectedValue + "'";

when I change the selection in the combobox, the text in the text box

changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?

If I do exactly the same thing but binding to a datagrid rather than the

textbox it updates the dataset correctly


"Nicholas Paldino [.NET/C# MVP]" wrote:

> Paul,
>
> If you are not using binding context, then how are you binding to

the
> data set? The DataBindings collection and the BindingContext classes

are
> tied together, and you can't really have one without the other.
>
> What exactly are you doing in order to create a data binding?
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> news:B9**********************************@microsof t.com...
> > I have a textbox bound to a dataview, when I update the text in the
> textbox no changes take place in the underlying dataset. Why is this??
> >
> > any answers appreciated, as to due to the underlying structure of the
> datasets, i.e lots of child tables etc, I cannot use bindingcontext
> >
>
>
>


Nov 16 '05 #7

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!

"Paul Slavin" wrote:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #8

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!

"Paul Slavin" wrote:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #9

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,

"RailGapIndicatorId" );

and I change the view in the textbox based on the currently selected item

in a combobox on the same form:

this.rgiDataView.RowFilter = "BlockOrOLId = '" +

this.blockIdComboBox.SelectedValue + "'";

when I change the selection in the combobox, the text in the text box

changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?

If I do exactly the same thing but binding to a datagrid rather than the

textbox it updates the dataset correctly


"Nicholas Paldino [.NET/C# MVP]" wrote:

> Paul,
>
> If you are not using binding context, then how are you binding to

the
> data set? The DataBindings collection and the BindingContext classes

are
> tied together, and you can't really have one without the other.
>
> What exactly are you doing in order to create a data binding?
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> news:B9**********************************@microsof t.com...
> > I have a textbox bound to a dataview, when I update the text in the
> textbox no changes take place in the underlying dataset. Why is this??
> >
> > any answers appreciated, as to due to the underlying structure of the
> datasets, i.e lots of child tables etc, I cannot use bindingcontext
> >
>
>
>


Nov 16 '05 #10

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
thanks for your reply... heres a bit more detail

I'm binding to a dataview:

this.rgiDataView = new DataView();
this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,

"RailGapIndicatorId" );

and I change the view in the textbox based on the currently selected item

in a combobox on the same form:

this.rgiDataView.RowFilter = "BlockOrOLId = '" +

this.blockIdComboBox.SelectedValue + "'";

when I change the selection in the combobox, the text in the text box

changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?

If I do exactly the same thing but binding to a datagrid rather than the

textbox it updates the dataset correctly


"Nicholas Paldino [.NET/C# MVP]" wrote:

> Paul,
>
> If you are not using binding context, then how are you binding to

the
> data set? The DataBindings collection and the BindingContext classes

are
> tied together, and you can't really have one without the other.
>
> What exactly are you doing in order to create a data binding?
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> news:B9**********************************@microsof t.com...
> > I have a textbox bound to a dataview, when I update the text in the
> textbox no changes take place in the underlying dataset. Why is this??
> >
> > any answers appreciated, as to due to the underlying structure of the
> datasets, i.e lots of child tables etc, I cannot use bindingcontext
> >
>
>
>


Nov 16 '05 #11

P: n/a
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!

"Paul Slavin" wrote:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??

any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext

Nov 16 '05 #12

P: n/a
errr....sorry about the multiple posts msdn was playing up earlier and telling me my post hadn't been receieved!!!!...oh well, in case your interested, i've fixed my problem, the value was changing in the dataset but the rowstate wasn't because I was not explicitly calling endedit on the updated row! that will teach me to try and actually get some work done after lunch time when my brain has shut down!!!

"Paul Slavin" wrote:
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
> thanks for your reply... heres a bit more detail
>
> I'm binding to a dataview:
>
> this.rgiDataView = new DataView();
> this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
> this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,
"RailGapIndicatorId" );
>
> and I change the view in the textbox based on the currently selected item
in a combobox on the same form:
>
> this.rgiDataView.RowFilter = "BlockOrOLId = '" +
this.blockIdComboBox.SelectedValue + "'";
>
> when I change the selection in the combobox, the text in the text box
changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?
>
> If I do exactly the same thing but binding to a datagrid rather than the
textbox it updates the dataset correctly
>
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
> > Paul,
> >
> > If you are not using binding context, then how are you binding to
the
> > data set? The DataBindings collection and the BindingContext classes
are
> > tied together, and you can't really have one without the other.
> >
> > What exactly are you doing in order to create a data binding?
> >
> >
> > --
> > - Nicholas Paldino [.NET/C# MVP]
> > - mv*@spam.guard.caspershouse.com
> >
> > "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> > news:B9**********************************@microsof t.com...
> > > I have a textbox bound to a dataview, when I update the text in the
> > textbox no changes take place in the underlying dataset. Why is this??
> > >
> > > any answers appreciated, as to due to the underlying structure of the
> > datasets, i.e lots of child tables etc, I cannot use bindingcontext
> > >
> >
> >
> >

Nov 16 '05 #13

P: n/a
errr....sorry about the multiple posts msdn was playing up earlier and telling me my post hadn't been receieved!!!!...oh well, in case your interested, i've fixed my problem, the value was changing in the dataset but the rowstate wasn't because I was not explicitly calling endedit on the updated row! that will teach me to try and actually get some work done after lunch time when my brain has shut down!!!

"Paul Slavin" wrote:
thanks for replying yesterday Nicholas,

after further debugging, ive discovered that the change is actually taking place in the dataset but the rowstate remains as Unchanged!!!! so when I write back to the database no changes found and hence none are commited.... now i'm even more confused, i'm not accepting changes anywhere before I try and update.... oh well more debugging!!!!
"Paul Slavin" wrote:
In order for the updates to be written from the dataset to the database, i have to hit a save button on the form which ensures that any changed controls have lost focus!!
"Nicholas Paldino [.NET/C# MVP]" wrote:
Paul,

When checking the value in the textbox, have you left the focus of the
textbox? The value will not be written to the dataset until the focus is
lost (more specifically, when validation is complete, which usually happens
when focus is lost).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
> thanks for your reply... heres a bit more detail
>
> I'm binding to a dataview:
>
> this.rgiDataView = new DataView();
> this.rgiDataView.Table = this.ds.Tables["ATPBlockOrOL"];
> this.rgiNormTxtBox.DataBindings.Add( "text", rgiDataView,
"RailGapIndicatorId" );
>
> and I change the view in the textbox based on the currently selected item
in a combobox on the same form:
>
> this.rgiDataView.RowFilter = "BlockOrOLId = '" +
this.blockIdComboBox.SelectedValue + "'";
>
> when I change the selection in the combobox, the text in the text box
changes correctly, but when I change text in the textbox the changes aren't
reflected in the dataset. Am I doing something fundamentaly wrong?
>
> If I do exactly the same thing but binding to a datagrid rather than the
textbox it updates the dataset correctly
>
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
> > Paul,
> >
> > If you are not using binding context, then how are you binding to
the
> > data set? The DataBindings collection and the BindingContext classes
are
> > tied together, and you can't really have one without the other.
> >
> > What exactly are you doing in order to create a data binding?
> >
> >
> > --
> > - Nicholas Paldino [.NET/C# MVP]
> > - mv*@spam.guard.caspershouse.com
> >
> > "Paul Slavin" <Pa********@discussions.microsoft.com> wrote in message
> > news:B9**********************************@microsof t.com...
> > > I have a textbox bound to a dataview, when I update the text in the
> > textbox no changes take place in the underlying dataset. Why is this??
> > >
> > > any answers appreciated, as to due to the underlying structure of the
> > datasets, i.e lots of child tables etc, I cannot use bindingcontext
> > >
> >
> >
> >

Nov 16 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.