UI Design

UI Design

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


Inquistive_Mind posted on Tuesday, January 30, 2007

Hello All,

             I need to build a prototype as a proof of concept.The requirement is that the UI fields change based on a certian criteria before it is presented to the user. Say for example I have Payroll Calculating form where in I have few fields.Example Name,ID,Hours,Payrate,Salary.

             Now if I were to use this form to calculate the salary of an employee in say Dept 1 then the label text should change to EmployeeName,EmployeeID,EmployeeHours,EmployeePayRate,EmployeeSalary.If it is for a Student then all fields change to StudentName,StudentID,StudentHours etc etc.

As of now the type of controls and the datatype they take is not an issue only the label text should change according to a criteria.But if its possible to change the control as well then it would be great.For the sake of Labels i looked at Themes and Skins but they are only meant for changing the style and each Label cannot be themed.I am thinking something in terms of an XML file where the ID of the label and the text of the label is predefined and the XML file itseld is stored as the criteria name.Then on the page load the Label text is changed based on the values in the XML file and the criteria.Also the Label text should be used for report generation.The backend database stays the same.The Business objects stays the same.

Is there any other way to do this???

Any information would be Helpful.Please Advice.

Thanks In Advance

SonOfPirate replied on Tuesday, January 30, 2007

I presume this is a web app.  If so, then the MultiView control is how I have accomplished this.  Create a separate view for each variation and toggle the display based on the criteria for each.  This is the simplest way to go.

If you are looking at a dynamically-created form, that's another story.  In that case, simply use conditional statements to determine which controls are included.

How are you generating your reports?  Are you using SQL Server Reporting Services or dumping the html to the client's printer?  If the latter, than having the user simply select Print while the form is on screen will accomplish that.  If you are using a reporting tool, then create a separate report for each and alter the url used to access the report based on the criteria.

Keep in mind that just because your Employee and Student share a common BO today, your use case could change and you could need to split this into separate BO's in the future to accomodate differences in the behavior and/or properties of each.  The MultiView allows you to maintain separate forms within a single page.  This will make it much easier to separate them in the future if needed as well.

Consider whether this is all worth it though.  Is there a reason why a single form with Name, ID, Hours, etc. labels for the fields is not good enough?  Just a thought.

HTH

 

 

Inquistive_Mind replied on Tuesday, January 30, 2007

SonOfPirate:

I presume this is a web app.  If so, then the MultiView control is how I have accomplished this.  Create a separate view for each variation and toggle the display based on the criteria for each.  This is the simplest way to go.

If you are looking at a dynamically-created form, that's another story.  In that case, simply use conditional statements to determine which controls are included.

How are you generating your reports?  Are you using SQL Server Reporting Services or dumping the html to the client's printer?  If the latter, than having the user simply select Print while the form is on screen will accomplish that.  If you are using a reporting tool, then create a separate report for each and alter the url used to access the report based on the criteria.

Keep in mind that just because your Employee and Student share a common BO today, your use case could change and you could need to split this into separate BO's in the future to accomodate differences in the behavior and/or properties of each.  The MultiView allows you to maintain separate forms within a single page.  This will make it much easier to separate them in the future if needed as well.

Consider whether this is all worth it though.  Is there a reason why a single form with Name, ID, Hours, etc. labels for the fields is not good enough?  Just a thought.

HTH

 

 

Thanks for your time and information.Yes it is a Web Application and the form conrols will be generated dynamically.This is just a prototype I need to build. Have not thought about reports yet but yes in all probablity will be using SQL Server Reporting Services.I am new to web developement and CSLA but now that you have mentioned Multiview I will look into it.

         Regarding reason for having a single form with changing Label Texts is to target different domains.Clients are very particular about the Label fields.Let me give you another example.A form for Inventory management has say a field called txtNumber and a Label associated with with text Number and id lblNumber.This field when used by Asset Mangement Department would like to see it as Asset Number Or Serial Number where as the Parts Management department would like to see it as Parts Number.However the Business Object would still be InventoryManagementBO.Hope this makes the requirement clear.

Thanks again

V

ajj3085 replied on Tuesday, January 30, 2007

Why not just have another field that says Student or Employee, instead of trying to change the label? 

Inquistive_Mind replied on Tuesday, January 30, 2007

ajj3085:
Why not just have another field that says Student or Employee, instead of trying to change the label? 

 

Thanks Andy for your interest.

The number of criteria can vary and be large.Student,Employee,Customer,Client.....Reuirement is One form with Fixed number of controls but the way information is presented to the user is different.Only the Label Text associated with the controls should change.(Changes only to the UI)

ajj3085 replied on Tuesday, January 30, 2007

Ok, I thought the fields would always be the same.

SonOfPirate replied on Tuesday, January 30, 2007

That explanation makes sense and I have run across this before.  I would strongly suggest to your "customer" that they consider standardizing their nomenclature.  Not only would it make your job easier but it would certianly simplify interdepartmental communications if they were all talking the same language, ya know?

Take a look at the MultiView control.  I think this will do the trick for you.  And, since you can have as many views as desired in the control, if another department creeps up with a different way of looking at the data you can just add another one in.

With regards to the reporting, however, you will run into one of two options if you are using server generated reports.  The first is to create a separate report for each variation.  This is consistent with the MultiView approach.

But, let me suggest an alternative, if you are certain that the layout and contents of each view will be the same and it is truly only the labels that vary.  I would create a table in your database that maps the field name to the text that should appear as well as whatever condition determines the appropriate value to use.  So, for instance, if it is the Department that determines the view, have a table with Department, Field and Label columns.  You may also want to separate these by form if necessary.

Then you can create a BO to retrieve the information based on the current department (and form?).  Data-bind your label controls to this BO while binding the data controls (textboxes, drop-down lists, etc) to your original BO and you'll be able to accomplish it with a single form.  You can then use the same information to do the same thing in the report and have one form and one report.

My final suggestion, and this may be simpler from a coding standpoint is to create a separate resource file for each department.  Then you can pseudo-bind your labels to the appropriate resource file in the Page's PreRender event.  For instance:

NameLabel.Text = (string)Page.GetGlobalResourceObject(currentDepartment, "Name");

As long as there is a resource file matching the value of the currentDepartment variable, you'll be all set.  (Plus you set yourself up for globalization - always a nice selling point when doing a POC!)

HTH

 

 

Inquistive_Mind replied on Wednesday, January 31, 2007

Thanks again for your detailed explanation.I was thinking something in terms of your last suggestion of using resource files.

          The criteria is stored in the Application["variable_name"] and on each page Page_PreInit i am checking the criteria and binding the label text with the corresponding resource file values.At this time binding each label.text with values seems feasible but as number of criteria increase and the number of labels increases the complexity would increase (mapping is in the order of n * m ).Right now for the demo 5 criteria and about 15 labels.So i have like 5 switch statements and 15 mappings in each page Page_PreInit method . I want to eliminate this and right now working on that. Cant think of something whihc would do that :-(

        Thanks a lot again

V

Copyright (c) Marimer LLC