Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
400
How to eliminate the refresh and position change in ultra grid if the data source updated.
posted

Hi,

Senario: I have a grid which displays the queue of the patients who visits an hospital. Each time on adding a patient to the queue the grid losts it position and refreshing the datasource to update the queue. I know that it was happening because of each time I add a record I'm using the below statements to update the grid.

 

QueueMaster queueMaster = new QueueMaster();

ugQueue.DataSource = queueMaster.GetTodaysQueue();

ugQueue.Refresh();

these statements will run every time after adding a new record to the database.

how can i eliminate the situation so that, the position of the grid remains stable even the was datasource updated?

Any help will be appriciated.

 

With regards,

SreeRam.

Parents
No Data
Reply
  • 1775
    posted

    1. Don't reassign DataSource. Don't do this:

    msrs_it said:
    ugQueue.DataSource = queueMaster.GetTodaysQueue();

    You can call something like Merge if  queueMaster.GetTodaysQueue(); returs a datatable or a dataset. Or don't throw away the objects in QueueMaster when updating from database. Make QueueMaster a singleton and let it add new records into existing data (for instance, dataset/datatable) instead of recreating everything from scratch

    2. You can remember the position of datagrid and reset it after you rebind the data. But then such things as filters, sorting, groups etc. will be lost. So, the first solution is much more preferable. 

Children
No Data