(CSLA 1.53 Data Binding) Form's 1st bound control requires 2 tab key presses to exit

(CSLA 1.53 Data Binding) Form's 1st bound control requires 2 tab key presses to exit

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


duffman posted on Wednesday, August 16, 2006

If your having this subject's problem, I might save you the hours I spent looking for someone else with it and then solving it.  Probably over a hundred hours now.  Yes, manic, I know...

My problem was that on a form, the user had to press the tab key twice to leave the first UI control bound to a business object.  After that, everythink worked ok.

I traced it to a failure b/t the control's Validating() and Validated() events, lost somewhere in MS code.  For some reason, the Validating() event was satisfied the 2nd time tab was pressed.  For hours and days and weeks I tell you.

The [Browsable(false)] attribute on properties is important, but it didn't solve this.  I have a generic BO layer b/t CSLA.BusinessBase and the table-centric BOs.  That layer has hashtables filled with other custom classes that represent various db schema values.

The generic BO had the [Serializable] class attribute.  As soon as I added [Serializable] to the classes that are added as objects to my BO's hashtables, the sun shined again, birds sang again and everything worked as expected.

I had this exact same problem even when the custom BOs inherited straight from BusinessBase and merely had the generic BO model hanging on as a property in the custom BOs.  I missed that page if it was in the book.  Did I mention the hours and...

rei replied on Friday, February 04, 2011

I'm having the exact same problems. I tried to add

<Serializable()> _ to the bo class but it didn't resolve it. I hope you can reply to this... been working on for hourssssssssssssss and dayssssssssssssssss

ajj3085 replied on Friday, February 04, 2011

This post is about five years old..

What version of Csla are you using?  What UI, .Net framework version, etc?

rei replied on Tuesday, February 08, 2011

I'm using csla v1.0.33, vb.net 2008, and .net framework 3.5

i bind the texboxes by

bindfield(txtboxname,"text", datasource, datamember)

ie. BindField(txtLname, "Text", mClient, "LastName")

 

The work around i have is to manually pass the value to the business object in the _validating event by typing something like

mclient.lastname=txtlname.text

There are so many fields and that is why i don't want to use the workaround stated above.

when i put break points with out using the work around to trace the problem, it turns out that the _validating gets fired but it doesn't reach the _validated. The _validated gets fired only after i tab out of the text field again.

Thanks a lot in advance!

 

 

ajj3085 replied on Tuesday, February 08, 2011

Wow.. Csla 1.0?  There have been tons of databinding fixes from 1.0 to 3.8.3, the latest version you could use with .net 3.5. 

At the very least I'd consider going to 1.53, as the solution stated in the first post may work if you got to that version.

rei replied on Wednesday, February 09, 2011

We tried upgrading to 1.53 but it's giving me the error "type 'safedatareader' is not defined"

:(

JonnyBee replied on Wednesday, February 09, 2011

Hi,

The SafeDataReader still exists in Csla 4 so maybe your Csla version 1.0 has been updated with a later SafeDataReader?

This alone should not stop you from upgrading - just make sure that the class SafeDataReader exists in you actual version.

rei replied on Wednesday, February 09, 2011

Thanks for your reply! it's very much appreciated.

The csla we used were just provided to us. We basically just add a reference to the dll files... which means I don't know whether or not the version we have has been updated with a later safedatareader.

do you know where we can get the csla DLL's (version higher than 1.0) that has the class SafeDataReader?

Thank you in advance!

 

 

 

 

JonnyBee replied on Wednesday, February 09, 2011

First: Use Reflector free version from RedGate (free until 30.5.2011) and you can disassemble the code to VB.NET or C#.

Then: Goto http://reflectoraddins.codeplex.com/ and get http://filegenreflector.codeplex.com/. FileGenerator will create a VS2005 or VS2008 solution with code and resources unless the code has been Obfuscated.

SafeDataReader is included with Csla 1.53 download, available on the Csla download page: http://www.lhotka.net/cslanet/Download.aspx

So you should check if the SafeDataReader in your Csla has been updated from a newer Csla (in namespace Csla.Data) or if there is other issues that causes the exceptions.

 

 

rei replied on Wednesday, February 16, 2011

Thanks for your reply. I finally got the chance to upgrade to csla 1.53 and resolve the safedatareader error.

It now compiles. However, i get the error "cannot create channel sink to connect to url" when the get statement is called. ie

result =

CType(DataPortal.Fetch(New Criteria(UserID)), User)

:(

when i change the reference back to the old version, it goes through just fine. :(

 

 

 

 

Copyright (c) Marimer LLC