StrataFrame Forum

BO's in webforms question

http://forum.strataframe.net/Topic4417.aspx

By Keith Chisarik - 11/14/2006

So I understand that there is no dropping of BO's on webforms, you create the BO reference in your ApplicationBasePage and it available to the entire website. Check.



Does that mean I need to create many BO's if I need them populated differently? For instance I have a BO that contains codes used to fill all my applications dropdowns, I have a BO on each form that calls a fill specific for the proper contents of the BO based on a "codetype" field.



So the generic question is this, since BO's essentially don't get instantiated into individual objects on a webform where I can call different fill methods, is the answer to make many BO's specified to their task, or am I on the wrong path?
By StrataFrame Team - 11/14/2006

No, just reuse the business object that you declare... the good thing about a web solution is that you will only have one page loaded at a time for the person.  Also, any business object that you declare there will get stored in a session variable, so you don't want to go hog wild on the business objects that you define within the ApplicationBasePage.
By Keith Chisarik - 11/17/2006

Can you please enlighten me as to how I might make the web textbox control either have a darker type or not have as dark a grey background when the BO is in read-only mode. It is very hard to read. I looked in the source, but didn't see the spot. I know I don't want to touch the source, once I know what to change I will create my own control and inherit your textbox.
By Trent L. Taylor - 11/17/2006

Well, you are embarking upon the quest that we have battled from the beginning...Microsoft's inconsistent controls. Smile  Just do this, drop on a text box and play with the properties (Backcolor, ForeColor, etc) until you get the look you are going for.  Once this is done, just create your own textbox that inherits directly from the .NET control (not ours).  Then open up the SF source code, and look at the Web TextBox control.  Copy all of the guts out of this thing...in fact, you can copy this whole class and just rename the class to your new class...obviously in a different project than the SF source.

There is an interface property called BindingEditable.  The code inside of here is what managed the readonly state.  You will see that the code currently controls the Enabled property.  Place your code here...just keep in mind that the standard .NET control does not let you control the disabled background and foreground colors..thus the problem we have dealt with.  It basically will require us doing some rendering, which we just hve not taken the time to do, when the control is disabled.

By Keith Chisarik - 11/17/2006

ewwww thanks.
By Trent L. Taylor - 11/17/2006

Yeah...sorry for the not so cheery answer Tongue
By Bastian Töpfer - 8/9/2007

so.. will you do the extra rendering that is required to be able to change the disabled color?

I know this is not your top priority, but so far every client asked me if I can change the disabled color, because it is very hard to read on a lot of screens.

thanks for the update!

By Keith Chisarik - 2/23/2010

bump from 2006 Tongue

Is this on the radar at all ? I just got a newweb project and this was the first thing they commented on in the demo.

By Keith Chisarik - 2/23/2010

As a workaround (to not having to do the more time consuming workaround above) I want to programatically set the

IgnoreManageUIReadOnlyState to True and the Readonly state to True, if the form is in "view mode" which results in the text being very readable, and not able to be changed by a user.

A SF web textbox renders as System.Web.UI.WebControls.TextBox even though it is MicroFour.StrataFrame.UI.Web.TextBox at design time.

Conversion attempts so I can get at the SF properties fail:

CType(ctrl, MicroFour.StrataFrame.UI.Web.TextBox).IgnoreManageUIReadOnlyState = True

I want to loop through all the controls on the form and set the properties as above, how to accomplish?

Setting them manualy in the code behind works, but I have like 100 controls and that is messy for maintenance.

Me.txtLastName.IgnoreManageUIReadOnlyState = True

Me.txtLastName.ReadOnly = True

By Trent L. Taylor - 2/24/2010

Just FYI here Keith, we actually never do this online anymore (the read-only states I mean) when developing online apps. Instead of having two modes, we just let them type away which fires the IsDirtyChanged event which allows us to enable a Save button, etc. Would this work for you?
By Keith Chisarik - 2/24/2010

My need is actually for a HR person to be able to review a lengthy application. So the data should not be editable.

I use the same form as when the applicant does data entry for application review by HR staff, this saved (time and budget)having to create a PDF or report of the application, they just go to the app via a "special" link and the form knows to pull up the corret populated application for review and print. So I dont think I can allow the data to be changed.

By Trent L. Taylor - 2/24/2010

If this is the case, why not bind to a label? On the web especially, this can make this type of thing far easier to work with. I am just throwing some ideas out there.
By Keith Chisarik - 2/24/2010

I was just trying to reuse the existing form since it is so big. Using labels would require a new form, with well over 100 fields and lots of tedious layout. Lots of time.

If I can just set those two properties to TRUE or FALSE conditionally I am done.