Hi everybody,I faced one interview question in interview that ,

Where should you write the code(for properties like back ground color etc) which applies for every page of your website when application of your website starts? and please give the example also.

Please give the answer.

Thank you,
Aravind

If you're developing in ASP.NET, you'd use the .css file ProgrammersTalk mentioned on a master page, and have all your content pages use the same master, so as to ensure that the style is employed on all of your pages.

Thanks for your valuable answers.

Is there any thing like if click a button something should happen in all of web pages(like change of background color).If Yes Where should I place the code and how?

Please answer.

Thank you,
Aravind.

If it were me, and mind you I'm still quite new to ASP, I'd put it in the master page and store the change in a cookie or session variable. The master page is for material (including layout) that will be rendered on every page, and you just specify parts of it wherein the content will vary by page. Do some research on how to use them. :icon_wink:

If your application is written in ASP.Net 2.0 , you can create a master page that will be the template for all pages inside the web site.

Or if it is asp.net 1.1, you can create a base class using the PageTemplate design pattern and all other pages will extend the base class to achive common look and feel, etc.....

This article has been dead for over six months. Start a new discussion instead.