M
Me
Hi,
I have inherited an application that contains 7 different but similar forms
(about 15 questions are the same on all forms) that a user can fill out.
Each page is a separate webform containing duplicate UI (for the same
questions) and the code to process these questions is duplicated on all of
the pages.
I'd obviously like to reduce the code duplication and i have come up with
three options.
1) Create a composit control for each question which would contain the UI
and code (validation, saving to object before DB, etc) for itself.
2) Create a base code behind page containing all the duplicate stuff... but
this seems like a pain because I'd need to have the UI controls declared in
the base class. However, that would pose a problem in the Design tab of the
IDE because the IDE would try to insert the controls into the super class
which would become a conflict with the base class. I like this method best,
but the designer problem I mentioned would have to be corrected... any ideas
on that?
3) Create a utility class that would contain all the code to handle the UI
controls, but then I'd have to pass references to everything into the utility
class because the Page, Session, and all the controls would be out of scope.
Well, those are the option. I like 2 the best but that designer problem
would have to be fixed, or a workaround would have to be available.
Thanks
I have inherited an application that contains 7 different but similar forms
(about 15 questions are the same on all forms) that a user can fill out.
Each page is a separate webform containing duplicate UI (for the same
questions) and the code to process these questions is duplicated on all of
the pages.
I'd obviously like to reduce the code duplication and i have come up with
three options.
1) Create a composit control for each question which would contain the UI
and code (validation, saving to object before DB, etc) for itself.
2) Create a base code behind page containing all the duplicate stuff... but
this seems like a pain because I'd need to have the UI controls declared in
the base class. However, that would pose a problem in the Design tab of the
IDE because the IDE would try to insert the controls into the super class
which would become a conflict with the base class. I like this method best,
but the designer problem I mentioned would have to be corrected... any ideas
on that?
3) Create a utility class that would contain all the code to handle the UI
controls, but then I'd have to pass references to everything into the utility
class because the Page, Session, and all the controls would be out of scope.
Well, those are the option. I like 2 the best but that designer problem
would have to be fixed, or a workaround would have to be available.
Thanks