Insert View

Insert View

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


MadGerbil posted on Thursday, August 31, 2006

I'm using a multi-view control to display a collection and the accompanying insert view (like Project Roles in the book) and it works wonderfully, except when I go to add a 2nd role - when I do that the BoundField still contains the information from the last role I added.  What do you have to do to clear out the old values?

Jav replied on Thursday, August 31, 2006

The only way I have been able to achieve what you are asking is by resetting the DataSourceID of the CslaDataSource that is supplying the data to the control.  I don't know if that is the only way - but it seems to work.

Remember, it is not just the matter of having clean and empty textboxes, you in fact want to trigger the Select event on the CslaDataSource, which will bind the controls to the "new" object with the blank instance variables.

Jav

MadGerbil replied on Thursday, August 31, 2006

Thank you...that triggered a thought.

I was doing the rebind in the iteminserted event but I was only doing the rebind on the grid control and not the entire multiview.  Once I fixed that, the problem was solved.

Jav replied on Friday, September 01, 2006

There is another twist in the story, I'm afraid.  I am finding out that with FormViews (and probably also with DetailViews - as RolesEdit), the only way to go from one record to the next - and have the textboxes clear up - is to:
      1. Turn the Paging on
      2. Use a Collection in the CslaDataSource
      3. Provide a way in the DataSource for the FormView to get a total count of Records (rows).  (If not, the FormView will load the entire collection everytime you go from one page to the next.)

Jav

JoeFallon1 replied on Friday, September 01, 2006

I thought Rocky just provided a way to get the total count.

Maybe a new Interface.

Check his website for changes to 2.1.

Here is his comment in another thread: (Paging in Windows Forms)

"In CSLA .NET 2.1 there's a new interface, IReportTotalRowCount (currently in Csla.Web, but moving to Csla.Core). You can implement this interface on your collection if you want the collection to only contain a page of data - but still be able to report how many total rows of data are available overall. This is used by CslaDataSource to help implement paging.

You'd probably need similar data when implementing paging in a Windows Forms grid."

Jav replied on Friday, September 01, 2006

Hi Joe,

Long time no see.  Smile [:)]

I was told of the same thing in another thread today.  Do you now if going from 2.0.3 to 2.1 involves reworking of the code in the business layer.  I stayed away from 2.1because that was the impression I got when Rocky first made it available.  I just didn't feel I had the time to refactor hundreds of my objects one more time.

Jav

ajj3085 replied on Friday, September 01, 2006

Jav,

I think at most you'll have to change your custom Rule / Authorization methods to be static instead of instance methods (well, alternately find AddRule and change to AddInstanceRule, if you want to keep the instance level rules).  Other than that, I don't think there are any other breaking changes. 

Jav replied on Friday, September 01, 2006

Thanks for sharing that AJ.  Ordinarily, I try to keep up with Rocky, but this time there were deadlines to meet.  With what you are saying, it may be worthwhile for me to set aside a little time for this.

Jav

Copyright (c) Marimer LLC