Dear Infragistics experts,
I have a WebExplorerBar on my MasterPage with most of it's items set via markup. But I programmatically add a few items to a certain ExplorerBarItem in code. This is done in the Load event of the MasterPage.
When you navigate from page to page there's not a problem. But one page has a button. When this button is clicked a postback is happening (ofcourse) and this is when the problem occurs.
Apparantly the WebExplorerBar is using ViewState, but it lost information on the items which were added in code. This 'causes an 'object or reference not set' error.
What am I doing wrong?
Update:
I've even put everything on 1 single Page in a brand new test solution. A WebExplorerBar (with some items via markup), a ScriptManager and a Button. In the load event I add 2 items when it's not a postback. When I run the solution it works fine. When the button is clicked I get an error. I'm starting to think it's not my fault, to be honest.
Would someone from Infragistics care to take a look at this?
Hello DannyvdK,
thank you for sharing this with community.
The answer from an Infragistic's employee:
"The issue happens because you are not databinding the WebExplorerBar. You are declaring the items in the markup,When you add the other in the code behind in this scenario the ExplorerBar is trying to synchronyze the view state with the declared items through the markup.I recommend you binding the ExplorerBar to dataSource.In this case you should add the items inside the DataBound event handler."
Apparantly the WebExplorerBar works better if it's databinded. So I declared a XMLDatasource in markup and pointed it to a XML file which contained my static menuitems. Then in the DataBound event I programmatically add the dynamic items.
What is the answer? I am having a similar problem