This is a migrated thread and some comments may be shown as answers.

LoadOnDemand persistence over PostBack

4 Answers 110 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 2
Sergey asked on 13 Aug 2010, 04:43 PM
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. 

4 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 13 Aug 2010, 05:38 PM
Hello Sergey,

I don't think what you're doing is possible with LoadOnDemand enabled, since LoadOnDemand will always clear the items list.
0
Sergey
Top achievements
Rank 2
answered on 16 Aug 2010, 04:08 PM
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. 
0
Accepted
Simon
Telerik team
answered on 16 Aug 2010, 04:19 PM
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
0
Sergey
Top achievements
Rank 2
answered on 16 Aug 2010, 07:55 PM
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. 
Tags
ComboBox
Asked by
Sergey
Top achievements
Rank 2
Answers by
Cori
Top achievements
Rank 2
Sergey
Top achievements
Rank 2
Simon
Telerik team
Share this question
or