LoadOnDemand persistence over PostBack

5 posts, 2 answers
  1. Sergey
    Sergey avatar
    22 posts
    Member since:
    Jun 2009

    Posted 13 Aug 2010 Link to this post

    Hey, 

    I'm attempting to replicate this demo ( http://demos.telerik.com/aspnet-ajax/combobox/examples/programming/addremovedisableitemsclientside/defaultcs.aspx ). The gist is that I need to either disable or hide items after they've been selected by the user. The issue I am having is that the hiding or disabling of an item is not persisted over a postback caused by the AutoPostBack property of the ComboBox. 

    This seems like it should be trivial based on the 'Preserving Changes' section of http://www.telerik.com/help/aspnet-ajax/combo_clientsidebasics.html

    ComboBox declaration (LinqDataSource for feeding data): 
    <telerik:RadComboBox ID="SearchPeopleAttribute" runat="server" AutoPostBack="true" Skin="Windows7" AllowCustomText="true"
                           DataSourceID="SearchPeopleAttributeDS" EnableAutomaticLoadOnDemand="true" EnableVirtualScrolling="true" EnableLoadOnDemand="true" ItemsPerRequest="30" EnableItemCaching="true" Filter="Contains"  ShowMoreResultsBox="true" DataTextField="Name" DataValueField="DepartmentPersonAttributeID"
                           EmptyMessage="Search person attribute..." OnClientSelectedIndexChanging="SearchPeopleAttribute_SC" OnSelectedIndexChanged="SearchPeopleAttribute_SelectedIndexChanged" Width="175px" />

    JavaScript IndexChanging:
    function SearchPeopleAttribute_SC(sender, eventArgs) {
               var item = eventArgs.get_item();
               var combo = $find("<%= SearchPeopleAttribute.ClientID %>");
               //alert(combo.get_id());
               combo.trackChanges();
               //alert(item.get_text());
               item.disable();
               combo.commitChanges();
           }

    Forgot to mention, .NET 4, VS 2010, Q12010 Telerik Release. 

    Any suggestions? 

    Cheers. 
  2. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 13 Aug 2010 Link to this post

    Hello Sergey,

    I don't think what you're doing is possible with LoadOnDemand enabled, since LoadOnDemand will always clear the items list.
  3. Sergey
    Sergey avatar
    22 posts
    Member since:
    Jun 2009

    Posted 16 Aug 2010 Link to this post

    Hmm, I guess maybe I am misinterpreting the linked articles? 

    If that's the case, does anyone know a good way to handle dropdowns with a very large number of items. I'm looking for something that only loads 20 or so items and the rest is through the show more functionality, or by filter. 
  4. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 16 Aug 2010 Link to this post

    Hello Sergey,

    You are interpreting the articles correctly however the documentation for 'Preserving Changes' is incomplete - it misses to state that the functionality does not work with Load On Demand Items - so please excuse us for the caused inconvenience. We will update the article immediately.

    Regarding your last question, here is a demo showing how to implement the 'show more' functionality.

    Kind regards,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Sergey
    Sergey avatar
    22 posts
    Member since:
    Jun 2009

    Posted 16 Aug 2010 Link to this post

    Hmm, noted about the doc change. Cheers. 

    I ended up redoing how the page works as I want the performance that LoadOnDemand provides in this case, but I needed to also track changes and items in the combobox. 
Back to Top