I'm not a beginner, but the more I think about this issue, the more I'm troubled for not finding an elegant solution.
Writing a C# .NET web site, I realized that there are several components that I need use in different pages, with more or less the same functionality, and I want to find a way to write them once and then reuse.
For example, a search box or several GridViews which I use in several pages. This "components" are built of several ASPX controls, methods, maybe some JavaScript, etc.. They are too complicated to be just duplicated and too specific to be created as controls.
What do you think should be the best approach of writing an reusing such elements. These are the solutions I've found so far, each with each own drawbacks:
iframe - as a matter of fact, with all of its problems works fine for me (for the search box). I wrote one aspx/cs page with all the search behavior (it's quite complicated) - and then on each page I want this search box, I add an iframe.
Master pages - this one I've found quite tricky. I've found out you could write a nested master page, but I could not figure out how could that help me. The Master page method - sets the child page as the first page (which calls its parent Master). But in my case, I have the main page which has his child components.
3.UpdatePanel - I could use UpdatePanel - and write a shared function that will populate it with the required components and code. Ok, that might work, but the code is very hard for maintenance (you need to write all the components manually with C#)
Any idea ? Did I miss anything trivial solution .