I have a dataGridView and a REST web service that I use to get records from a database - these are formed as objects and bound to the dataGridView.
They are not as closely bound to a database as is traditional with SQL Server etc, (bear in mind I can't utilise the full functionality of a dataGridView with all of Microsoft's products as is the usual case with databinding, due to it being a REST web service done in Java etc).
I have also enabled a paging mechanism on my web service to get 100 records at a time e.g.
http://mywebservice/employees/0/100
What I want to do is automatically ping the web service for another 100 records when the user scrolls the scrollbar to the bottom of the dataGridView. It then adds these records to the dataGridView - which now shows 200 records, and so on.
Is there a way to do this reasonably simply? Is my idea sound? One thing I was stuck on was trying to understand a way to know when the user has scrolled to the bottom of the dataGridView .
What you want is basically 'Lazy load with infinite scrolling'.
Here is a pretty good article on this:
http://www.eggheadcafe.com/tutorials/aspnet/b8381915-06d9-4538-b4bb-5ac2a8e73f34/implementing-continuous-s.aspx
Plus you might want to check out SlickGrid.
Demo: http://mleibman.github.com/SlickGrid/examples/example6-ajax-loading.html
Related
I am using MS Access linked to an SQL backend DB. Thus, design mode is unavailable in Access.
For one of the columns I want to be able to have a drop-down (combo-box) functionality where only the users will be able to select a value from the drop-down list.
I was able to do constraint in the SQL table, which restricts the values that can be entered, but this doesn't create the drop-down list in Access.
I searched and found this Is it possible to use a drop down list in a linked table in MS Access but no solution was provided.
thanks
For data entry by users, don't let them use the table directly, build a form instead.
There you can use drop-down boxes and everything else.
If you like the look and feel of datasheets, use the datasheet form wizard for a simple starting point.
You can (and should) build a form. (don't allow users to open a table directly, as then you can't really verify data input, and provide a workable UI to the users.
And you can even create a data sheet form. So, it will look and feel much like a table anyway.
And with dropping a combo box into that form? Then you are free to setup the combo box source that provides the list of choices.
In fact, often I will using a multiple-items form (a continues form), and the reason is that you can put multiple kinds of controls on that form.
this allows you to create forms like this:
So in above, we have buttons, check boxes, combo box etc. So, you have a lot more flexibly.
You never really wanted to allow or have direct use of tables. They are not in general for appcations and contrlling the user interface, but only a handy way for users to edit data. The instant you want control of the layout, and to use things like buttons, combo boxs, check box as above shows?
Then build your custom form for this purpose. As general rule, you really don't want users to edit tables directly - you have no control over what they can do, and this tends to make applications very hard to write, and control the user experience.
I'm using Siaqodb for my client side database engine in a Sync Framework silverlight project. I've switched to siaqodb because microsofts client side solution loads the entire database into memory at once and, as such, has a hard time handling large data.
I've bound a list of SiaqodbOfflineEntity objects to a silverlight datagrid in order to create an editable datagrid. Unlike microsofts solution, you can't bind the database entries directly to the datagrid. You have to query the database and bind a list of in memory objects to the datagrid. This causes a problem in that the database isn't immediatly updated when the datagrid cell is changed. I'm trying to find the best way to handle updates to the database after a change in the cell. I can't just update each item to the database because the siaqodb engine will mark the item as dirty even if no change was made to the object. This will cause conflicts when trying to sync. holding a cached version of the original list and then comparing each property of each object to find which ones have changed seems like it would work, but seems to be a bit cumbersome. I've also tried looking at some of the datagrids events but RowEditEnded doesn't appear to fire when a cell is edited and CurrentCellChanged seems to fire whenever I switch rows (odd).
There's got to be a better solution to this. Anyone have any ideas?
So I've gotten this to work by changing my offline entity classes to implement iNotifyPropertyChange and I think this is a reasonable solution. I set the PropertyChanged event to a function that saves the object to the database. There is a VS package called notifypropertyweaver that will inject this code at compile time, reducing the amount of work needed to be done on auto-generated entity code.
We have a windows program written in vbasic(i think) and we are re-writing the same program in c#. In the old program there is a grid. When we click any cell and as soon as edit the cell content the data in database is changing. In our new program we couldn't find the way of doing that. So we added some buttons for database actions like update selected cell.
What is the best way to do that?
You can do this in c# too.Use a datagridview and to bind with the database so that change in the grid effect database see here
Out of seeing dozens of legacy ODBC frontends put together in Access I would strongly advice not to commit changes in the database at real time. Instead try to create a lightweight process that helps the users to keep their data's quality high.
If you want this kind of functionality you could have the real time changes saved in a different schema, a set of different tables or with a flag that tells that these rows are unverified edits by the user X.
Rasel already gave you a pointer how to do the functionality in C#.
I am building a multiuser WPF application (requirement is a desktop app), database SQL Server 2008.
There are two types of users.
The first type user will enter a record which would be stored in a table.
The second type user initially will be presented with a listbox with the records from the table. The requirement is that the listbox must be updated live (i.e. if a new record is entered by the first user the listbox must be updated).
Currently I have not yet implemented the Database functionality.
I am currently working with ObservableCollection and simulating this scenario.
I would like to know the best approach for achieving this.
Should i use a timer and keep querying the table? Is there a more efficient way?
Is this even possible (should I switch to ASP.NET?) ?
I would appreciate any suggestions and tips that you may have.
Try using SqlDependency, since it can raise an event (OnChange) in your code when the results of a query would change on the server (as the result of an INSERT or UPDATE from another user or process, for example)
An example of its use on CodeProject for a simple live chat application:
http://www.codeproject.com/KB/database/chatter.aspx
I created a gwt app with a gxt combobox. I have it where it pulls data (a list of names apprx 5000) from the database places it in an array which in turns places it in a store. That is then placed in the combobox using set store, so when a user starts typing in the combo it searches through the store for the name. My question: is this the best way to do this or is there another method.
How is the performance loading that list of 5000 names? Does it take a long time to load your page? You may want to think about loading them as you need them so that the gui loads faster.
This article suggest 'lazy loading' gui components
http://googlewebtoolkit.blogspot.com/2008/11/improving-performance-with-on-demand.html
How have you pulled down the list? I assume is via RPC, have you used a Data Transfer Object?, XML?
This link talks about options for serialization http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
Michael