Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Databinding go away

Status
Not open for further replies.

apex1x

IS-IT--Management
Aug 14, 2002
396
US
I have a form with a couple comboboxes, which are bound to a particular datasource. The form itself is bound to a different databinding.

Problem: When one of the comboboxes has an item selected, all the comboboxes automatically switch to the selected value. I realize they are all part of the same databinding, so I made a new databinding for each one of them. Solved... or maybe not... What happens now is that when the position of form is changed, any changes made to individual comboboxes carry over to the next form.

Any suggestions for a potential solution? The only thing I can think of at this point is to do an SQL query to see if each combobox really has data bound to it, and if not, to set the combobox index to -1.
 
check if the page isposting back and if so, don't repopulate the combo boxes or form depending on the situation
 
Is this a windows or web project?

Are you databinding to a dataset?
 
This is a windows project (actually a mobile 5.0) and I'm databinding to a dataset at design time.

What do you mean "if the page is posting"?

Interestingly enough, the original databinding (the first one) of the series of comboboxes, acts as normal and clears when a new record is added or moved through.

ie. there are three comboboxes for parts
first is bound to partsbindingsource
second is bound to partsbindingsource2
third is bound to partsbindingsource3

the first one acts as I would expect, but the others keep their selected values for some reason.

Ideas?
 
Sorry, "page is posting" is a web event. I should have asked what kind of solution you were solving.
 
In your dataset, did you create a data relation for the data adapters for the combo boxes to the main table? I'm assuming these combo boxes serve as lookup tables.

Creating data relations keeps your data synchronized.

Personally I don't use datasets in this way because I feel it promotes bad performance with lots of data adapters.
 
My dataset is simple enough as to not need any sort of relations.
I've simply bound the combobox datasource to the appropriate table from the dataset.

I made a mistake in my observations though. Apparantly when I make a change to ANY of the comboboxes, the last value selected remains as the default when I switch records or add a new record.
Is there a way around this? I cant just reset all the indexes to -1 because if I'm editing a record, how would the program know which was just added and which were there from the beginning?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top