Base class and controls

R

Rans

Hello,

I made a base class for all the pages in my project, so that instead
of "public class CSomePage : System.Web.UI.Page" i got "public class
CSomePage : CPage

Since some parameters are common to all pages, i did put some server
hidden fields controls in the base class.

Ex: (in the base class)

protected Gam.CHiddenField mIdEntreprise;
protected Gam.CHiddenField mIdCoord;

Like that, i put some <asp:CHiddenField ... /> in each aspx and i can
reference my controls (mIdEntreprise and mIdCoord) in the derived
classes. Works great.

However when i modify the html code in an aspx the vs editor is adding
the following code in the derived class :

protected Gam.CHiddenField mIdEntreprise;
protected Gam.CHiddenField mIdCoord;

Thus overriding the declarations in the base class, resulting in
errors at runtime. I have to remove the declarations in the derived
class manually everytime, very annoying. How can i stop the vs editor
to add the declarations in the derived class, if the control is
already declared in the base class?

Thanks for any help. Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top