|
-
July 10th, 2011, 12:49 PM
#1
Databound combobox question
Hi Guyz,
I am having a question about a data bound combo box on a winform. There is a set of applications comprising of:
- A client side application for users distributed geographically accessing a SQL Server database
- An admin application that accesses the database and can manipulate the database
- A web service that connects the client application to the database
The client application has dataset objects that hold the data pulled out from the database on startup. This is done to minimize the database calls.
Now the scenario is, there is a winform in the client application which has a combo box populating the ids for that particular transaction. At a time only one transaction is active; the rest are either closed, to be started in future,or cancelled.
The admin who uses another application, has a direct access to the database and can control the transaction status. If the transaction does not result in a success, it has to be cancelled by the admin, in which case, it is simply made unavailable for any further deals.
Now my requirement is to remove the cancelled transaction from the data bound combo box, in the client application's winform, when it is removed from the data source table/view. Currently, if the form is reopened, then the data source is reloaded and everything just works fine. However, which event should be handled to make it work with out refreshing the entire form or the panel or anything else but the combo box? The cancelled transaction should simply go from the list. Is there any elegant way to do this? Let me know...and thanks for reading through
Bhushan
-
July 11th, 2011, 02:32 PM
#2
Re: Databound combobox question
When the admin controls the transaction and edits the status, right on that event,
you can refresh so to speak the combobox like this:
//first remove all items from combo
this.comboBox1.Items.Clear()
//then add the data back to the combobox
this.comboBox1.DataSource = bindingList;
or you can try the refresh method
this.comboBox1.Refresh() or this.comboBox1.Databind()
Let me know if this works
Need a new website? Need custom software developed? IT consultation? Visit www.irnsystems.com to find out more details.
-
July 12th, 2011, 12:39 PM
#3
Re: Databound combobox question
@DemSamPro
Thanks for your suggestions. Will try them and let you know. However, I have to figure out when to use them. I mean the admin application has certain flags, based on which the transaction is cancelled and the client application just does not have a clue whether a transaction has been cancelled and it remains in the combobox. So the real question is as to when to fire the refresh for the combo in the client application and on what condition? The conditional update is made by admin application and it is well aware of the conditions under which it was done. However, the datasets used to update the data at the admin and client locations are different and cannot directly communicate with each other due to multiple credential checks needed. To add to it, I think, the data-source is a '.DefaultView' of a datatable and there is a filter condition on that. One more reason, I think, it is not updated when the underlying datasource is updated.
Anywayz, will check and let u know
Thanks
Bhushan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|