473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

databinding problem

Hello,

I'm using typed dataset for databinding to windows controls and I'm having
some problems.

I'm trying to move all business logic to datatable column_changing events
and the problem that I'm having is when I change some other column, control
value doesn't update immediately until I call endcurrentedit on
bindingmanager which doesnt happen until user click update button.

Here's my problem:

Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs) Handles
Me.ColumnChanging
Select Case e.Column.ColumnName

Case Me.dbaColumn.ColumnName

Me(0).categoryID = "changed_column"

End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.

How can I force databinding.update from dataset/datatable?

Thanks,

Vlado
Jan 25 '07 #1
7 2572
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.com ...
Hello,

I'm using typed dataset for databinding to windows controls and I'm
having some problems.

I'm trying to move all business logic to datatable column_changing
events and the problem that I'm having is when I change some other
column, control value doesn't update immediately until I call
endcurrentedit on bindingmanager which doesnt happen until user click
update button.

Here's my problem:

Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
Handles Me.ColumnChanging
Select Case e.Column.ColumnName

Case Me.dbaColumn.ColumnName

Me(0).categoryID = "changed_column"

End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.

How can I force databinding.update from dataset/datatable?

Thanks,

Vlado


Jan 25 '07 #2
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com. ..
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.com ...
>Hello,

I'm using typed dataset for databinding to windows controls and I'm
having some problems.

I'm trying to move all business logic to datatable column_changing events
and the problem that I'm having is when I change some other column,
control value doesn't update immediately until I call endcurrentedit on
bindingmanager which doesnt happen until user click update button.

Here's my problem:

Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs) Handles
Me.ColumnChanging
Select Case e.Column.ColumnName

Case Me.dbaColumn.ColumnName

Me(0).categoryID = "changed_column"

End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.

How can I force databinding.update from dataset/datatable?

Thanks,

Vlado



Jan 26 '07 #3
Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...

Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.com ...
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com. ..
>Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.co m...
>>Hello,

I'm using typed dataset for databinding to windows controls and I'm
having some problems.

I'm trying to move all business logic to datatable column_changing
events and the problem that I'm having is when I change some other
column, control value doesn't update immediately until I call
endcurrentedit on bindingmanager which doesnt happen until user
click update button.

Here's my problem:

Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
Handles Me.ColumnChanging
Select Case e.Column.ColumnName

Case Me.dbaColumn.ColumnName

Me(0).categoryID = "changed_column"

End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.

How can I force databinding.update from dataset/datatable?

Thanks,

Vlado




Jan 28 '07 #4
Still need an answer.

I made a workaround by creating an event under datatable and form subscribes
to it and calls BindingManager.EndCurrentEdit but would like to know if
there's another way.

Thanks,

Vlado
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com. ..
Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...

Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.com ...
>VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.com ...
>>Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews.c om...
Hello,

I'm using typed dataset for databinding to windows controls and I'm
having some problems.

I'm trying to move all business logic to datatable column_changing
events and the problem that I'm having is when I change some other
column, control value doesn't update immediately until I call
endcurrentedit on bindingmanager which doesnt happen until user click
update button.

Here's my problem:

Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
Handles Me.ColumnChanging
Select Case e.Column.ColumnName

Case Me.dbaColumn.ColumnName

Me(0).categoryID = "changed_column"

End Select
End Sub
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.

How can I force databinding.update from dataset/datatable?

Thanks,

Vlado




Jan 29 '07 #5
Why are you using the Column_Changing events? Just a masochist? In my
experience, events never work the way you think they should in .Net, or in
the order you think they should.

Anyway, if I understand what you're doing, you're changing the data source
and the change is not reflected in the data displayed in the controls on
the screen that are bound to that data source.

Have you checked out the BindingSource? It is an intermediary between your
controls and your data source, and immediately reflects any changes made to
the data source in the controls. To push it the other way, you invoke
EndEdit. Then of course, you have to call Update on your adapter to push
the changes down to the data source.

So you add a Binding Source (add the component to your form from the Data
toolbox).

Set the data source of it to your data table.

myBindingSource.DataSource = myDataTable

Then bind your controls to the BindingSource.

myTextBox.DataBindings.Add(new Binding("Text", _
myBindingSource, "CompanyName", true))

myGrid.DataSource = myBindingSource

See if that gets you anywhere. And answer my question at the top; maybe I
can recommend another solution.

I use the n-layer model, so all of the data I display on the screen is
defined in Classes. I capture changes to them when the Property value is
modified.

Robin S.
-------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.com ...
Still need an answer.

I made a workaround by creating an event under datatable and form
subscribes to it and calls BindingManager.EndCurrentEdit but would like
to know if there's another way.

Thanks,

Vlado
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com. ..
>Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...

Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.co m...
>>VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.co m...
Which version of .Net are you using? 2003 or 2005?

Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews. com...
Hello,
>
I'm using typed dataset for databinding to windows controls and I'm
having some problems.
>
I'm trying to move all business logic to datatable column_changing
events and the problem that I'm having is when I change some other
column, control value doesn't update immediately until I call
endcurrentedit on bindingmanager which doesnt happen until user click
update button.
>
Here's my problem:
>
Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
Handles Me.ColumnChanging
Select Case e.Column.ColumnName
>
Case Me.dbaColumn.ColumnName
>
Me(0).categoryID = "changed_column"
>
End Select
>
>
End Sub
>
>
Now, unerlying dataset.datatable(0).categoryID is indeed changed but
databound textbox control remains the same.
>
>
>
How can I force databinding.update from dataset/datatable?
>
>
>
Thanks,
>
>
>
Vlado
>
>




Jan 30 '07 #6
Robin,

I'm using Column_Changing mostly to validate input.
In this case, Column_Changing should change different column depending on
current column's value.

I know about BindingSource and I'm using BindingManager but that's on form
level.

I didn't find a way to force databinding update from a datatable except as a
workaround with raising Event as described.

Also, I do use n-tier model but Business and Data tier is contained in one
layer (Datasets/Datatable). All the validation/ updating datasource happens
here. This is acceptable scenario for us as we don't anticipate having
database source other than MSSQL and don't have problem with BusinessObjects
and DataLayer not being loosely coupled.
Again, the only problem is how to force Databinding, EndCurrentEdit from
Datatable.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Fr******************************@comcast.com. ..
Why are you using the Column_Changing events? Just a masochist? In my
experience, events never work the way you think they should in .Net, or in
the order you think they should.

Anyway, if I understand what you're doing, you're changing the data source
and the change is not reflected in the data displayed in the controls on
the screen that are bound to that data source.

Have you checked out the BindingSource? It is an intermediary between your
controls and your data source, and immediately reflects any changes made
to the data source in the controls. To push it the other way, you invoke
EndEdit. Then of course, you have to call Update on your adapter to push
the changes down to the data source.

So you add a Binding Source (add the component to your form from the Data
toolbox).

Set the data source of it to your data table.

myBindingSource.DataSource = myDataTable

Then bind your controls to the BindingSource.

myTextBox.DataBindings.Add(new Binding("Text", _
myBindingSource, "CompanyName", true))

myGrid.DataSource = myBindingSource

See if that gets you anywhere. And answer my question at the top; maybe I
can recommend another solution.

I use the n-layer model, so all of the data I display on the screen is
defined in Classes. I capture changes to them when the Property value is
modified.

Robin S.
-------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.com ...
>Still need an answer.

I made a workaround by creating an event under datatable and form
subscribes to it and calls BindingManager.EndCurrentEdit but would like
to know if there's another way.

Thanks,

Vlado
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.com ...
>>Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...

Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews.c om...
VB.Net 2005 and Datatable/TableAdapter.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast.c om...
Which version of .Net are you using? 2003 or 2005?
>
Robin S.
------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:4L******************************@giganews .com...
>Hello,
>>
>I'm using typed dataset for databinding to windows controls and I'm
>having some problems.
>>
>I'm trying to move all business logic to datatable column_changing
>events and the problem that I'm having is when I change some other
>column, control value doesn't update immediately until I call
>endcurrentedit on bindingmanager which doesnt happen until user click
>update button.
>>
>Here's my problem:
>>
>Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
>System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
>Handles Me.ColumnChanging
>Select Case e.Column.ColumnName
>>
>Case Me.dbaColumn.ColumnName
>>
>Me(0).categoryID = "changed_column"
>>
>End Select
>>
>>
>End Sub
>>
>>
>Now, unerlying dataset.datatable(0).categoryID is indeed changed but
>databound textbox control remains the same.
>>
>>
>>
>How can I force databinding.update from dataset/datatable?
>>
>>
>>
>Thanks,
>>
>>
>>
>Vlado
>>
>>
>
>




Jan 30 '07 #7
Did you *try* the BindingSource? Because if you use one, and update the
underlying data source, the changes will be reflected on the bound
controls.

I've never used the Binding Manager; I always use a BindingSource because
it's to nifty. Give it a try, and let me know if it works.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:IZ******************************@giganews.com ...
Robin,

I'm using Column_Changing mostly to validate input.
In this case, Column_Changing should change different column depending on
current column's value.

I know about BindingSource and I'm using BindingManager but that's on
form level.

I didn't find a way to force databinding update from a datatable except
as a workaround with raising Event as described.

Also, I do use n-tier model but Business and Data tier is contained in
one layer (Datasets/Datatable). All the validation/ updating datasource
happens here. This is acceptable scenario for us as we don't anticipate
having database source other than MSSQL and don't have problem with
BusinessObjects and DataLayer not being loosely coupled.
Again, the only problem is how to force Databinding, EndCurrentEdit from
Datatable.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Fr******************************@comcast.com. ..
>Why are you using the Column_Changing events? Just a masochist? In my
experience, events never work the way you think they should in .Net, or
in the order you think they should.

Anyway, if I understand what you're doing, you're changing the data
source and the change is not reflected in the data displayed in the
controls on the screen that are bound to that data source.

Have you checked out the BindingSource? It is an intermediary between
your controls and your data source, and immediately reflects any changes
made to the data source in the controls. To push it the other way, you
invoke EndEdit. Then of course, you have to call Update on your adapter
to push the changes down to the data source.

So you add a Binding Source (add the component to your form from the
Data toolbox).

Set the data source of it to your data table.

myBindingSource.DataSource = myDataTable

Then bind your controls to the BindingSource.

myTextBox.DataBindings.Add(new Binding("Text", _
myBindingSource, "CompanyName", true))

myGrid.DataSource = myBindingSource

See if that gets you anywhere. And answer my question at the top; maybe
I can recommend another solution.

I use the n-layer model, so all of the data I display on the screen is
defined in Classes. I capture changes to them when the Property value is
modified.

Robin S.
-------------------------------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:ka******************************@giganews.co m...
>>Still need an answer.

I made a workaround by creating an event under datatable and form
subscribes to it and calls BindingManager.EndCurrentEdit but would like
to know if there's another way.

Thanks,

Vlado
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:eO******************************@comcast.co m...
Did you figure out the answer to this, or are you still hanging?
Because I have a pretty good idea, if you still need an answer...

Robin S.
---------------------------
"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
news:rp******************************@giganews. com...
VB.Net 2005 and Datatable/TableAdapter.
>
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:9a******************************@comcast. com...
>Which version of .Net are you using? 2003 or 2005?
>>
>Robin S.
>------------------------
>"Vlado Jasovic" <vladoDOTjasovicATexcelleincDOTcomwrote in message
>news:4L******************************@giganew s.com...
>>Hello,
>>>
>>I'm using typed dataset for databinding to windows controls and I'm
>>having some problems.
>>>
>>I'm trying to move all business logic to datatable column_changing
>>events and the problem that I'm having is when I change some other
>>column, control value doesn't update immediately until I call
>>endcurrentedit on bindingmanager which doesnt happen until user
>>click update button.
>>>
>>Here's my problem:
>>>
>>Private Sub BusinessPartnerDataTable_ColumnChanging(ByVal sender As
>>System.Object, ByVal e As System.Data.DataColumnChangeEventArgs)
>>Handles Me.ColumnChanging
>>Select Case e.Column.ColumnName
>>>
>>Case Me.dbaColumn.ColumnName
>>>
>>Me(0).categoryID = "changed_column"
>>>
>>End Select
>>>
>>>
>>End Sub
>>>
>>>
>>Now, unerlying dataset.datatable(0).categoryID is indeed changed
>>but databound textbox control remains the same.
>>>
>>>
>>>
>>How can I force databinding.update from dataset/datatable?
>>>
>>>
>>>
>>Thanks,
>>>
>>>
>>>
>>Vlado
>>>
>>>
>>
>>
>
>




Feb 1 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
9
by: J055 | last post by:
Hi I have a very simple configuration of the GridView with paging and sorting. When I do a postback the DataBinding event fires twice - in both the ProcessPostData and PreRender stages of the...
9
by: Nathan Sokalski | last post by:
I have a very simple UserControl which contains an Image and a Label, which I use to display an image with a caption. I am using this control inside a DataList, setting the two Public variables...
1
by: Owen Blacker | last post by:
I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious. I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.