Click here to Skip to main content
15,609,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a situation where I have to design web application for a big corporate client. They have 5 different company under it and they all want the same application but with different user interface and development manager decided to use just one code base for all the companies. I can reuse anything above presentation layer but I wanted to use same UI logic as well to make code maintenance easier.

Option 1 : For example I have ComapnyA_ValidateCustomer.aspx and CompanyB_ValidateCustomer.aspx and I can derive both the codebehind from some BaseValidateCustomer class. The problem here is I have to cast all the controls in BaseValidateCustomer class like

((Label)this.sender.FindControl("cusName")).Text = objCust.Name;

which makes it ugly and hard to maintain.

Option 2 : I can use CompanyA_ValidateCustomer.aspx.cs as a codebehind of CompanyB_ValidateCustomer.aspx page. Here it gets tricky because there are few controls specific to each company and the codebehind trows an error complaining it cannot find them if I don't put them in all the aspx pages which leads to have all 5 pages some controls which is of no use for that particular page. Again it will be a nightmare to maintain.

So the question is "Is there any other way I can achieve this ?"

1 solution

MVC would solve most of these issues. You can use the same controller with multiple views. See this SO thread for someone's approach in doing that:[^]
Share this answer
virang_21 28-Oct-11 19:14pm    
Well the app is running for one business unit and it is winforms application and it was tested and in production and now other business units wants it. I cannot go around and propose different architecture which leads to modification and testing for first business unit as well. I have to find viable solution in existing architecture. Thank you for your reply but I am afraid I cannot use MVC at this stage.
Nish Nishant 28-Oct-11 19:15pm    
Ok you have tagged the question as ASP.NET. Now you state that it's WinForms.
Nish Nishant 28-Oct-11 19:16pm    
I assume it was a typo for WebForms. If so, ignore my previous comment.
virang_21 28-Oct-11 19:19pm    
Sorry mate ... miss typed it.. it is webforms... I think I need another morning coffee ... :-)
Nish Nishant 28-Oct-11 19:20pm    
No problem. I should have seen it as an obvious typo, so I need some coffee too I guess :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900