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

runtime created ComboBox renders with wrong Items

3 Answers 59 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 2
Petr asked on 08 May 2010, 11:09 AM
Hello,

I'm creating the whole page dynamically in code-behind. There is a bunch of subsequent dynamic pages containing ComboBoxes. The problem is this: the RadComboBox Items get propagated/copied to subsequent ComboBox Items for unknown reason and overwrite the items that should actually be there.

Example:
a page1 contains a new RadComboBox() with dynamically added Items "A" and "B".
a page2 contains a new RadComboBox() with dynamically added Items "X", "Y" and "Z".

User visits page1, then goes to page2.

The page2's combo box is rendered with items "A", "B" and "Z" instead of proper "X", "Y", "Z".

The combo boxes do have different IDs, the Items do have different texts and values. The container (Panel) of the combo box has a different ID. There is no reason I could think of why the rendering is so messed.

When tracing the code with a debugger one can see it does the RIGHT THING, i.e. adds the right items (X, Y, Z) yet the resulting rendered page contains DIFFERENT items (old A, B from previous combo box with added third new item).

I am using the latest Q1 2010 Telerik Ajax but colleagues are seeing this problem with older releases as well (Q2 2009).

I have no idea how to debug this as it happens inside the Telerik toolkit... Please help, this is so frustrating.


3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 10 May 2010, 11:25 AM
Hi Petr,

Could you please send us your code so we can be able to inspect it and help you?

Thank you!

Regards,
Veronica Milcheva
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
Petr
Top achievements
Rank 2
answered on 10 May 2010, 11:42 AM
Unfortunately no, I don't have a short sample code for you yet. But I've been thinking about it hard and I think I know what's happening - it might be ASP.NET session state handling (or something similar) that tries to "restore" form controls values upon postback and blindly replaces the values in totally different controls. It would sort of explain the behavior I am experiencing.

The question is how to stop this from happening or how to instruct the ASP.NET (or who's doing that) that the controls are actually different on the different dynamic pages (that all are rendered into a single aspx page named like Container.aspx) so it shouldn't be replacing their values.
0
Petr
Top achievements
Rank 2
answered on 10 May 2010, 11:51 AM
Indeed, disabling ViewState on the container.aspx page fixed the issue. So ViewState is restoring controls contents blindly if they are created at run-time (overwriting them while ignoring control's ID etc.)
Tags
ComboBox
Asked by
Petr
Top achievements
Rank 2
Answers by
Veronica
Telerik team
Petr
Top achievements
Rank 2
Share this question
or