DataPortal SelectObkect event fires when hiding DetailsView fields.

DataPortal SelectObkect event fires when hiding DetailsView fields.

Old forum URL: forums.lhotka.net/forums/t/7577.aspx


RubyRed93 posted on Friday, September 04, 2009

I'm hoping I haven't found a possible CSLA bug, but I've searched and searched without an answer.  Hopefully I can describe the situation here clearly.

I have a DetailsView control for accepting new data and ultimately creating a new instance of my business object.  Within this view are two DropDownList controls.  The first has AutoPostback set to True so that once the user makes a selection, the second DropDownList will load depending on the previous selection.  All works fine until I decided to make the UI a bit nicer.

Since this first DropDownList is optional, I thought I'd hide the second control until a selection is made via the first.  I accomplished this by hiding the desired DetailsView Field (MyDetailsView.Fields(x).Visible = false).  I've found that this causes the data portal to fire the SelectObject event, thus clearing out all my other previously entered data.  Now, if instead I leave the Field intact and rather hide only the DropDownList iteself, all works fine.

I'm not sure if there's something I can do differently, or if this is a CSLA issue or a Microsoft issue.

Thanks!

RockfordLhotka replied on Friday, September 04, 2009

The select object event is raised when ASP.NET data binding tells the datasource control that it needs new data.

In other words, whatever you are doing at the UI level is triggering data binding to need new data, so it asks CslaDataSource for data, and CslaDataSource raises the event. That's the sequence that occurs here. It would happen with any data source control, because data source controls do what they do in response to data binding, which does what it does in response to whatever you do to the page and/or controls.

I know that's not an "answer" as such, but hopefully it helps you understand the data binding model you are dealing with.

Copyright (c) Marimer LLC