MVC Grid DropDown Editor Templates With Large DB

3 posts, 0 answers
  1. Umut
    Umut avatar
    7 posts
    Member since:
    May 2014

    Posted 09 Mar 2015 Link to this post

    I implemented inline editing for one of my Model(ClassRoom). And this model has a foreignkey coloumn which maps to the other table.(Teacher).
    But i have 100.000+ Teachers in my database. What is the efficient way to load Teachers.

    NOTE: (Also Teached is in the filter coloum. ) 
  2. Umut
    Umut avatar
    7 posts
    Member since:
    May 2014

    Posted 09 Mar 2015 in reply to Umut Link to this post

    Also in the demo : http://demos.telerik.com/aspnet-mvc/grid/foreignkeycolumn


    It is getting all the values of Foreign Key at first. It is not making a join query. 

    public ActionResult ForeignKeyColumn()
    {
    PopulateCategories();
    return View();
    }
  3. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 11 Mar 2015 Link to this post

    Hi Umut,

    Basically the easiest way to optimize the performance in current case is to make the target field complex type (to contain the nested object directly) and not use the ForeignKey column. This way each record would contain it's text representation and remove the need of loading all items initially. Additionally you can make the editor for this field to support search and load only the top 10 records from the search result (server filtering).  Please check the example below:

    Another option is to filter the values for the ForeignKeyColumn only to the ones that are selected in the current records. 

    Regards,
    Vladimir Iliev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top