This project is read-only.

Grid bind in mvc but append only new data at grid bind.

Dec 13, 2013 at 12:46 PM
Edited Dec 16, 2013 at 5:09 AM
Hello,
I have started recently to work on MVC.
I have a task for chat(question - answer) window, i have used a webgrid and binding it at HttpGet Action also refreshing it with in 5 sec time period. its done. But.
My issue is that how to append only those chat queries which are not answered. but every time at grid bind it hits the DB and bind all records.
I want to bind the new records to grid only not all records at every hit.
I am using mvc 4 (razor).

Any one can help?.. please post ..
Thanks.

Dharmendra
Dec 18, 2013 at 5:38 PM
Edited Dec 18, 2013 at 5:38 PM
Hi,

You can filter your questions before pass the collection to the grid, like
        public ActionResult Index()
        {
            var items = repository.GetAll().Where( i=> !i.Answered);
            return View(items);
        }