ServerBinding for multiple dropdowns in one View

4 posts, 0 answers
  1. GrayMeth
    GrayMeth avatar
    7 posts
    Member since:
    Jan 2014

    Posted 16 Sep 2014 Link to this post

    I have a View with multiple dropdowns(15-20). Currently I implemented server binding for all of these by creating ViewData for every dropdown before loading the View. Is this the best way for implementing multiple dropdowns(server binding)?
    Note: Don't want to use AJAX binding.
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 18 Sep 2014 Link to this post

    Hi GrayMeth,

    Based on the given information, I believe that the best way to accomplish your goal is exactly usage of the BindTo method and ViewData that holds the widget data. Here you can find more information how to bind the widget on server.

    If you more specific answer, I will need more information about your current implementation - Controller and View or even better a runnable test project.

    Regards,
    Georgi Krustev
    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. GrayMeth
    GrayMeth avatar
    7 posts
    Member since:
    Jan 2014

    Posted 24 Sep 2014 in reply to Georgi Krustev Link to this post

    Hi Gerogi,

    I am using the dropdown exactly as mentioned in the link provided by you, by using the BindTo() method of kendo dropdown.
    My controller method for returning the view will be something like this.
    public ActionResult XYZ()
    {
          ViewData["Dropdown1"] = ServiceCall1;
          ViewData["Dropdown2"] = ServiceCall2;
          ViewData["Dropdown3"] = ServiceCall3;
          ViewData["Dropdown4"] = ServiceCall4;
          ...
          ...
          ...
          // and so on
         // finally
         return PartialView("XYZ", XYZModel);
    }

    This is it. Simple one. My only concern is, if this the best way to apply the functionality. Is there any other way to improve the performance?
    I would try to provide you some sample project but this is it you will find in the sample also.

    Regards
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 26 Sep 2014 Link to this post

    Hi,

    If all dropdownlists on the page has a different data (different items), then using the ViewData to bind the widgets is absolutely applicable. Another approach is to use remote service with deferred binding (autoBind: false). Thus widgets will not fetch data until it is needed. Is there any performance issue that you want to resolve? In general, usage of particular technique depends on the desired business logic you are trying to achieve.

    Best regards,
    Georgi Krustev
    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
UI for ASP.NET MVC is VS 2017 Ready