Click here to Skip to main content
11,573,862 members (56,532 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 ?"
Posted 28-Oct-11 13:04pm
virang_2112.4K

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:

http://stackoverflow.com/questions/616072/single-controller-with-multiple-views[^]
  Permalink  
Comments
virang_21 at 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.
Nishant Sivakumar at 28-Oct-11 19:15pm
   
Ok you have tagged the question as ASP.NET. Now you state that it's WinForms.
Nishant Sivakumar at 28-Oct-11 19:16pm
   
I assume it was a typo for WebForms. If so, ignore my previous comment.
virang_21 at 28-Oct-11 19:19pm
   
Sorry mate ... miss typed it.. it is webforms... I think I need another morning coffee ... :-)
Nishant Sivakumar at 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)

  Print Answers RSS


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 28 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100