WebForms - multiple BO's on page with multiple DropDowns error


Author
Message
Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
I have an application with a page that should allow user to manage many details of some selected entity. Therefore there are 7 BO's on base page and 3 dropdowns (2 of them have populationtype BusinessObject, one Enumeration).

The page is loaded correctly at first but during postbacks in many cases it ends up with error saying that some of DropDowns has a SelectedValue which is invalid because it does not exist in the list of items. In this post I have described the same problem and the solution was to specify the TopMostItem. However - all of dropdowns has the TopMostItem set up!

The page works correctly when I remove these 3 dropdowns. I'm really confused by this behavior and cannot find the cause of this error.

I can email You my project (I cannot post it to whole forum) if necessary.

Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Could anybody give me any solution, workaround or at least a tip? I cannot continue and my customer is waiting for his application.

Please HELP!!!

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Jiri,

We have actually discussed this very problem on another thread before (http://forum.strataframe.net/FindPost17749.aspx).  On the web side, if a value doesn't exist within a DropDown, it will produce an exception.  You may not want to bind to those controls and set them in code so thaht you can take this into account.  Let me know if I am missing something here.

In regards to this post, there was a night last week where we did not get any updates with posts that came in, so I am sorry for the delay.

Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Trent,

I have mentioned this post in my first post in this topic. As I have written, all dropdowns has its TopMostItem set. When I delete all dropdowns except the one then it works fine (disregarding of which dropdown I select). Moreover - it doesn't produce error on all postbacks.

It seems that there is some problem when there are more dropdowns binded to several BO's. I'm sorry I cannot describe this problem more closely but I do not know what this problem comes from...

I really do not know what to do... :-(

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Jim,



Your best bet would be to create a sample app that reproduces the problem, without out any other noise. When I've done this the outcome has always been good.



I typically start by attempting to reproduce the problem by building something like my app, but not from my app. I.e. I use the SF sample db, a new app, new forms that are very simple and attempt to get the same behavior. If the behavior is reproduced, then the SF guys can usually either help me figure out what I'm doing wrong or they will ID a bug (and fix it).



However, more often Blush the problem is on my side. I'm able to identify it as I then start introducing elements from my application, one at a time until the problem occurs. In any case, you win! BigGrin



So, that's what I'd do (and what I do do) when I'm in your situation.



Good luck!
Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Trent, Greg,

I have created a very simple testing application that describes the problematic behavior. There are 4 tables and 4 corresponding BO's. On the default page I have 3 dropdonws with BusinessObject PopulationType and TopMostItem is set.

As You can see, the page is opened correctly but when You click on the button, an error message appears...

Thank You

Attachments
Test.zip (127 views, 38.00 KB)
Test.pkg (129 views, 13.00 KB)
Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Hi,

I have made some more investigation and found that when BO's are in editing state (in page_load I call *.Add() method for each object) it never causes an error until I click button that switches BusinessEditingState to Idle ( by calling *.Undo() method) - then the error appears again...  Sick

I need to solve this problem ASAP since my customer becomes eager. If there is no solution, please let me know. I will have to quit using SF in web projects and completely rebuild the current project returning back to standard web projects I have used before starting with SF. Though I like the design of SF, I cannot use it in my projects until such unpredictable, undocumented and unmanageable behavior occurs during runtime.

May be that some better documentation, more samples and videos about web development with SF would be very helpful...

I'm looking forward for Your answers.

Thank You

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Jiri,

I am going to load and run your sample, but I wanted to say one thing and that was..."WAIT!!!!!" Wink  The issue that you are fighting is just standard .NET (ASP.NET) and application specific, not SF.  In your previous post you said that you would have to re-write your application not using SF...that is a extreme overstatement and is absolutely nowhere near a solution.  I don't even have to look at your code to know that you could work through your problems without making major changes.  This all is application and ASP.NET development, period.  Thought you are using SF and may need to change how you are implementing something to prevent an error from occuring if the end-user does something...that is just programming.  So I will look at your sample and the post my findings, but your statements were a bit disconcerting and I wanted to stop you from taking some drastic approach that will not actually address the crux of the issue.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Jiri,

There were a lot of issues that I saw just with how you have created and structured this application.  So let's walk through each of these:

  1. You were calling the Add method in the PopulationDataSource properties of the combo.  This will never work as it is adding a new record to the internal BO created within the DropDownList, not the bound BO.  You will see that I corrected this in your code to call a Fill method, then added the Adds in the Load of the page.
  2. Secondly, you were never initializing the BOs values, thus, you could potentially have an issue.  You should always try and create code (Win or web forms) that will protect itself from potential errors.
  3. I know that this was a sample, but you should never really put your BOs in your web application project itself.  You should be creating a Business assembly that houses these BOs and then is referenced by the web application. (I did not correct this in your sample).
  4. The error that you were getting had nothing to do with SF but rather standard .NET data binding...so trying to strip out SF would not have made any difference.
  5. Not a big deal, but in VB you do not have to declare your BOs as properties and you can declare with the WithEvents tag and the framework will do the rest...just easier (this is in the ApplicationBasePage).

Most of the things that you were fighting here had nothing to do with web, but rather, just common .NET development and application development standards at large.  Please review the corrected sample to better understand my comments above.  Thanks. Smile

Attachments
Corrected_Jiri.zip (136 views, 778.00 KB)
Jiri Brazda
Jiri Brazda
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Hi Trent,

Regarding to Your findings:

  1. Excuse me, that was a mistake caused by trying to quickly generate a sample. Of course I do that correctly in my application.
  2. Ok, thank You, I will do that in my applications.
  3. You are right, I always do separate assemblies for BO's and UI
  4. Please see below
  5. Thank You for the tip!

However the problem still persist: Your corrected application works fine because You call Add methods for BO's in page_load. But I do not want to have all objects in editing state. I want to allow user to change editing status on the page. When You remove these methods from page_load, the page is loaded correctly but when You press the button, the error is produced - and this is exactly what I'm fighting with.

For better understanding of my problem I give here a real world example: There is a page in the application that contains employee details. Except details of the currenty employee I need to have list of his children, previous jobs, trainings passed etc. For all of these BO's I need to allow user to see list of records and allow him to add/edit children, trainings ect. on the workers page. So at this moment I cannot set all of these BO's to editing state in page load but at the moment when user clicks the "Add child", "Edit training" etc...

Thank You

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search