Wednesday, 24 September 2014

Viewstate of a DropDownList is lost on postback using ComponentArt Dialog Control

As long time users of ComponentArt ASP.NET controls we're well aware of their shortcomings and the company's lack of enthusiasm about fixing bugs.

We've recently had a problem with populating data into a dropdown list that's inside a ComponentArt Dialog Control on the initial load of a page.

The dropdown list is populated but on subsequent postbacks the information is lost and viewstate errors may be seen. Here is the forum page where there are a lot of complaints but no viable solution.

This is really not acceptable because this is the kind of problem that really stops your development in its tracks. We do however have a simple solution.

The problem seems to be related to the control lifecycle internal to the ComponentArt controls.

You can resolve the issue by populating the dropdown list (or other problematic control) by overriding a different method.

OnLoad - fail
OnInit - fail
OnPreRender - works
OnLoadComplete - works

This correctly persists the items in the dropdown list control and also the users selection through postbacks.

Why not check out our network audit product using the ComponentArt controls?

No comments:

Post a Comment