I’m making a website that has a menu on all the pages that needs to be changed frequently. Right now I’m copying the code of the menu in all the pages, and so, if the menu needs to be changed, I have to open each page and change the menu there.
Is there any way by which I could define a function in a file somewhere that just writes the menu code using Response.Write() and then keep calling that function on all the pages that need the menu? That way whenever I’d need to make changes to the menu, I’ll only make it in the function definition.
Master page is the perfect candidate.
Add the menu in master page.
You can also create a user control for this.
But if you want a function for doing a common task through out the site then create a class
and add the function is that class. Create an object of that class and call the function
anywhere in the site.