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

Recommended Answers

All 8 Replies

seperate CSS file :) it's much more organized hehe.. give example?

* {
background-color: #000000
}

in something.css

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:

HI Infarction,

Could you please just elaborate and give example.

thanks
Aravind

Could you please just elaborate and give example.

No. Look it up yourself.

Arvind you should try using a search engine called google!!

Try this site Download that tool. Start learning from it.

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.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.