5 Answers, 1 is accepted
One suggestion is to switch ViewState off (enableViewState="false"). When ViewState is enabled, the contents are remembered each time a Postback happens, and it is repopulated with these remembered values.
If ViewState is switched off then this will no longer happen, because
the values are not remembered between Postbacks. Instead, the
instead it gets populated from scratch each time.
This way we can make sure that the control populated only once.
Since the code is in a WebUserControl and is nested in a RadGrid it's always going to be loaded on a PostBack. So this is how I fixed the issue. I changed the code to just loop thru the record set and add the values to the RadComboBox.
I've made a sample page with a RadComboBox in a user control with its AppendDataBoundItems property set to True and its items are not duplicated unless you rebind your control upon each post-back which then is the default behavior since you want the new items to be appended to already existing ones.
In case I'm missing something in your scenarios, then please someone open a support ticket and provide a runnable sample which we could debug locally.
All the best,
the Telerik team
try making an ajax page that has a radgrid which in turn uses user control to insert/update entries.
User control's markup
some code behind
(note that this is a copy-paste from existing project, not new project to test issue in separate environment)
I set breakpoint in BindGimletProductionPublishInstances and when it's hit I step and see items count, in the end of the method ddlGimletProductionPublishInstances.Items.Count says it has 2 items (as should), I let debugger go, expand combobox and see 3 items: first - my own item and next 2 are the same.
Workaround: set in markup AppendDataBoundItems="false"
and change BindGimletProductionPublishInstances method to add items manually: