G
Guest
Hi,
I inherited a web application that has several very similar forms for
gathering user data. User's must choose the form that best fits their needs
and fill it out. Each form has about 15 questions that are the same and a
few that are different.
The problem is that each form contains duplicate UI code and duplicate code
in the code behind to handle these duplicate questions... I know, but I
inherited the app.
I want to get rid of as much code duplication as I can and my first thought
is to have one code behind file that would inherit from System.Web.UI.Page.
Then each of the "real" code behind files would inherit from the
"baseCodeBehind". BaseCodeBehind would contain all the webcontrol
declarations and code to handle these controls, including the event handlers
for buttons and the like. Then each "real" code behind would have the
form-specific controls declared and handled.
It seems like this should work, but in the short time I have reviewed it,
the IDE inserts the control declarations into the "real" code behind and then
i get an error saying that the control has already been declared in the
BaseCodeBehind.
So, is this a viable solution? Are there any other potential problems that
I haven't seen yet?
I inherited a web application that has several very similar forms for
gathering user data. User's must choose the form that best fits their needs
and fill it out. Each form has about 15 questions that are the same and a
few that are different.
The problem is that each form contains duplicate UI code and duplicate code
in the code behind to handle these duplicate questions... I know, but I
inherited the app.
I want to get rid of as much code duplication as I can and my first thought
is to have one code behind file that would inherit from System.Web.UI.Page.
Then each of the "real" code behind files would inherit from the
"baseCodeBehind". BaseCodeBehind would contain all the webcontrol
declarations and code to handle these controls, including the event handlers
for buttons and the like. Then each "real" code behind would have the
form-specific controls declared and handled.
It seems like this should work, but in the short time I have reviewed it,
the IDE inserts the control declarations into the "real" code behind and then
i get an error saying that the control has already been declared in the
BaseCodeBehind.
So, is this a viable solution? Are there any other potential problems that
I haven't seen yet?